From c1459f60d084d8be5d967a4353087fce0384019a Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 3 Dec 2025 00:27:26 +0800 Subject: fix solaris build --- .github/workflows/solaris.yml | 49 ------------------------------------------- core/src/tbox/tbox | 2 +- core/xmake.lua | 5 +++++ core/xmake.sh | 5 +++++ 4 files changed, 11 insertions(+), 50 deletions(-) diff --git a/.github/workflows/solaris.yml b/.github/workflows/solaris.yml index 6f4dbba76..964532b1a 100644 --- a/.github/workflows/solaris.yml +++ b/.github/workflows/solaris.yml @@ -7,56 +7,7 @@ on: types: [published] jobs: - check: - runs-on: ubuntu-latest - outputs: - should-run: ${{ steps.check.outputs.should-run }} - steps: - - name: Random execution check - id: check - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const outputFile = process.env.GITHUB_OUTPUT; - - // Always run for release events - if (context.eventName === 'release') { - fs.appendFileSync(outputFile, `should-run=true\n`); - core.info('Release event detected. Will run tests.'); - return; - } - - // Execution probability (default 50%, can be overridden via env) - const probability = parseFloat(process.env.RUN_PROBABILITY || '0.5'); - - // Generate deterministic "random" number based on commit SHA, run ID, and current time - // Adding time ensures better randomness while keeping same commit/run consistent - const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency - const seed = context.sha + context.runId + timeSeed; - let hash = 0; - for (let i = 0; i < seed.length; i++) { - const char = seed.charCodeAt(i); - hash = ((hash << 5) - hash) + char; - hash = hash | 0; // Convert to 32-bit integer - } - // Normalize to 0-1 range - const random = Math.abs(hash) / 2147483647; - const shouldRun = random < probability; - - // Use environment file instead of deprecated set-output - fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); - if (shouldRun) { - core.info(`Random check passed (${(random * 100).toFixed(2)}% < ${(probability * 100).toFixed(0)}%). Will run tests.`); - } else { - core.info(`Random check failed (${(random * 100).toFixed(2)}% >= ${(probability * 100).toFixed(0)}%). Skipping.`); - } - env: - RUN_PROBABILITY: ${{ vars.SOLARIS_RUN_PROBABILITY || '0.5' }} - build: - needs: check - if: needs.check.outputs.should-run == 'true' runs-on: ubuntu-latest concurrency: diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox index 1d777aca2..5ec46dff6 160000 --- a/core/src/tbox/tbox +++ b/core/src/tbox/tbox @@ -1 +1 @@ -Subproject commit 1d777aca24121df60d4219e08c0230e30fb05756 +Subproject commit 5ec46dff6581ce3b0c2b3ea42bfd766fcd91ef24 diff --git a/core/xmake.lua b/core/xmake.lua index e819f572b..216eae3eb 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -24,6 +24,11 @@ add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing", "-Wno- -- add definitions add_defines("_GNU_SOURCE=1", "_FILE_OFFSET_BITS=64", "_LARGEFILE_SOURCE") +-- ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +if is_plat("solaris") then + add_defines("_POSIX_C_SOURCE=200112L", "_XOPEN_SOURCE=600") +end + -- add vectorexts --[[ if is_arch("x86", "x64", "i386", "x86_64") then diff --git a/core/xmake.sh b/core/xmake.sh index 5a8fcb072..fd8291cc9 100755 --- a/core/xmake.sh +++ b/core/xmake.sh @@ -12,6 +12,11 @@ set_languages "c99" # add definitions add_defines "_GNU_SOURCE=1" "_FILE_OFFSET_BITS=64" "_LARGEFILE_SOURCE" +# ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +if is_plat "solaris"; then + add_defines "_POSIX_C_SOURCE=200112L" "_XOPEN_SOURCE=600" +fi + # disable some compiler errors if is_plat "macosx"; then add_cxflags "-Wno-error=deprecated-declarations" "-fno-strict-aliasing" "-Wno-error=nullability-completeness" "-Wno-error=parentheses-equality" -- cgit v1.3.1 From 5cca7326533561f20fd54021721c8d71d890c38a Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 3 Dec 2025 00:29:27 +0800 Subject: update xmake.sh --- core/src/tbox/tbox | 2 +- core/xmake.lua | 3 ++- core/xmake.sh | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox index 5ec46dff6..d18d6f972 160000 --- a/core/src/tbox/tbox +++ b/core/src/tbox/tbox @@ -1 +1 @@ -Subproject commit 5ec46dff6581ce3b0c2b3ea42bfd766fcd91ef24 +Subproject commit d18d6f97242b25cea9da8d16def04022642138c5 diff --git a/core/xmake.lua b/core/xmake.lua index 216eae3eb..31be4464c 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -25,8 +25,9 @@ add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing", "-Wno- add_defines("_GNU_SOURCE=1", "_FILE_OFFSET_BITS=64", "_LARGEFILE_SOURCE") -- ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +-- _XOPEN_SOURCE=600 implicitly sets _POSIX_C_SOURCE=200112L if is_plat("solaris") then - add_defines("_POSIX_C_SOURCE=200112L", "_XOPEN_SOURCE=600") + add_defines("_XOPEN_SOURCE=600") end -- add vectorexts diff --git a/core/xmake.sh b/core/xmake.sh index fd8291cc9..41c09483f 100755 --- a/core/xmake.sh +++ b/core/xmake.sh @@ -13,8 +13,9 @@ set_languages "c99" add_defines "_GNU_SOURCE=1" "_FILE_OFFSET_BITS=64" "_LARGEFILE_SOURCE" # ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +# _XOPEN_SOURCE=600 implicitly sets _POSIX_C_SOURCE=200112L if is_plat "solaris"; then - add_defines "_POSIX_C_SOURCE=200112L" "_XOPEN_SOURCE=600" + add_defines "_XOPEN_SOURCE=600" fi # disable some compiler errors -- cgit v1.3.1 From 1e982e47f0c1af1db9276db6fe07f9b6e8c85920 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 3 Dec 2025 00:29:54 +0800 Subject: improve tests --- tests/benchmarks/build_targets/test.lua | 5 +++++ tests/benchmarks/config_targets/test.lua | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/benchmarks/build_targets/test.lua b/tests/benchmarks/build_targets/test.lua index 8660dbe52..28d239b54 100644 --- a/tests/benchmarks/build_targets/test.lua +++ b/tests/benchmarks/build_targets/test.lua @@ -15,6 +15,11 @@ end function test_build(t) + -- 20% random trigger + if math.random() > 0.2 then + return + end + if xmake.is_embed() then return end diff --git a/tests/benchmarks/config_targets/test.lua b/tests/benchmarks/config_targets/test.lua index 8eacf2dc1..e16bf12d2 100644 --- a/tests/benchmarks/config_targets/test.lua +++ b/tests/benchmarks/config_targets/test.lua @@ -15,6 +15,11 @@ end function test_config(t) + -- 20% random trigger + if math.random() > 0.2 then + return + end + if xmake.is_embed() then return end -- cgit v1.3.1 From 408fd6795601df3c7b838a74fdc28efd57c476e7 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 3 Dec 2025 00:37:53 +0800 Subject: revert ci --- .github/workflows/solaris.yml | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/solaris.yml b/.github/workflows/solaris.yml index 964532b1a..6f4dbba76 100644 --- a/.github/workflows/solaris.yml +++ b/.github/workflows/solaris.yml @@ -7,7 +7,56 @@ on: types: [published] jobs: + check: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.should-run }} + steps: + - name: Random execution check + id: check + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const outputFile = process.env.GITHUB_OUTPUT; + + // Always run for release events + if (context.eventName === 'release') { + fs.appendFileSync(outputFile, `should-run=true\n`); + core.info('Release event detected. Will run tests.'); + return; + } + + // Execution probability (default 50%, can be overridden via env) + const probability = parseFloat(process.env.RUN_PROBABILITY || '0.5'); + + // Generate deterministic "random" number based on commit SHA, run ID, and current time + // Adding time ensures better randomness while keeping same commit/run consistent + const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency + const seed = context.sha + context.runId + timeSeed; + let hash = 0; + for (let i = 0; i < seed.length; i++) { + const char = seed.charCodeAt(i); + hash = ((hash << 5) - hash) + char; + hash = hash | 0; // Convert to 32-bit integer + } + // Normalize to 0-1 range + const random = Math.abs(hash) / 2147483647; + const shouldRun = random < probability; + + // Use environment file instead of deprecated set-output + fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); + if (shouldRun) { + core.info(`Random check passed (${(random * 100).toFixed(2)}% < ${(probability * 100).toFixed(0)}%). Will run tests.`); + } else { + core.info(`Random check failed (${(random * 100).toFixed(2)}% >= ${(probability * 100).toFixed(0)}%). Skipping.`); + } + env: + RUN_PROBABILITY: ${{ vars.SOLARIS_RUN_PROBABILITY || '0.5' }} + build: + needs: check + if: needs.check.outputs.should-run == 'true' runs-on: ubuntu-latest concurrency: -- cgit v1.3.1