diff --git a/.github/docker/alpine-3.20.Dockerfile b/.github/docker/alpine-3.20.Dockerfile new file mode 100644 index 000000000..b9f17d963 --- /dev/null +++ b/.github/docker/alpine-3.20.Dockerfile @@ -0,0 +1,37 @@ +# Copyright (C) 2025 Intel Corporation +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# +# Dockerfile - a 'recipe' for Docker to build an image of Alpine +# environment for building the Unified Memory Framework project. +# + +# Pull base Alpine image version 3.20 +FROM alpine:3.20 + +# Set environment variables +ENV OS alpine +ENV OS_VER 3.20 + +# Base development packages +ARG BASE_DEPS="\ + cmake \ + git \ + g++ \ + make" + +# UMF's dependencies +ARG UMF_DEPS="\ + hwloc-dev" + +# Dependencies for tests +ARG TEST_DEPS="\ + numactl-dev" + +# Update and install required packages +RUN apk update \ + && apk add \ + ${BASE_DEPS} \ + ${TEST_DEPS} \ + ${UMF_DEPS} diff --git a/.github/scripts/alpine_build.sh b/.github/scripts/alpine_build.sh new file mode 100755 index 000000000..c9c82f1e3 --- /dev/null +++ b/.github/scripts/alpine_build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Copyright (C) 2025 Intel Corporation +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# alpine_build.sh - Script for building UMF on Alpine image + +set -e + +cd unified-memory-framework + +cmake -B build -DCMAKE_BUILD_TYPE=$1 -DUMF_BUILD_TESTS=ON -DUMF_BUILD_EXAMPLES=ON +cmake --build build diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 76e6bef16..ad990269d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,6 +13,8 @@ permissions: env: BUILD_DIR : "${{github.workspace}}/build" INSTALL_DIR: "${{github.workspace}}/build/install" + HOST_WORKDIR: ${{github.workspace}} + WORKDIR: /unified-memory-framework jobs: fuzz-test: @@ -370,3 +372,25 @@ jobs: SYCL: uses: ./.github/workflows/reusable_sycl.yml + + alpine: + name: Alpine + strategy: + fail-fast: false + matrix: + build_type: [Debug, Release] + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Build Alpine image + run: | + docker build . -f .github/docker/alpine-3.20.Dockerfile -t alpine_image + + - name: Run UMF build on Alpine image + run: | + docker run --rm --name alpine_container -i -v $HOST_WORKDIR:$WORKDIR alpine_image $WORKDIR/.github/scripts/alpine_build.sh ${{matrix.build_type}} diff --git a/src/utils/utils_log.c b/src/utils/utils_log.c index 2fd28fc2c..5fc5d6639 100644 --- a/src/utils/utils_log.c +++ b/src/utils/utils_log.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -10,7 +10,6 @@ #ifdef _WIN32 #include #else -#define _GNU_SOURCE 1 #include #include #include @@ -153,13 +152,21 @@ static void utils_log_internal(utils_log_level_t level, int perror, } errno = saveno; #else - char err_buff[1024]; // max size according to manpage. int saveno = errno; errno = 0; +#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE + char err[1024]; + int err_ret = strerror_r(saveno, err, sizeof(err)); + if (err_ret == ERANGE) { + postfix = "[truncated...]"; + } +#else + char err_buff[1024]; // max size according to manpage. const char *err = strerror_r(saveno, err_buff, sizeof(err_buff)); if (errno == ERANGE) { postfix = "[truncated...]"; } +#endif errno = saveno; #endif strncpy(b_pos, err, b_size);