From 462bde1b3c9267a12d7b6e3e8854dc0aff826550 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 12:50:34 +0800 Subject: [PATCH 01/11] debugci --- .github/workflows/ci-debug-macos-arm64.yml | 119 +++++++++++++++++++++ moebius/xmake.lua | 31 ++++++ 2 files changed, 150 insertions(+) create mode 100644 .github/workflows/ci-debug-macos-arm64.yml diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml new file mode 100644 index 0000000000..c2ca534c9f --- /dev/null +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -0,0 +1,119 @@ +name: Build and Test on macOS arm64 + +on: + push: + branches: [ main ] + paths: + - 'src/**' + - '!src/Plugins/Windows/**' + - 'tests/**' + - 'xmake.lua' + - 'xmake/packages.lua' + - 'xmake/research.lua' + - 'xmake/options.lua' + - 'xmake/requires.lua' + - 'xmake/targets/**' + - 'xmake/packages/**' + - 'xmake-requires.lock' + - 'lolly/Data/**' + - 'lolly/Kernel/**' + - 'lolly/Plugins/**' + - 'lolly/System/**' + - 'lolly/lolly/**' + - 'lolly/tests/**' + - 'lolly/xmake.lua' + - 'moebius/Data/**' + - 'moebius/Kernel/**' + - 'moebius/Scheme/**' + - 'moebius/moebius/**' + - 'moebius/tests/**' + - 'moebius/xmake.lua' + - '.github/workflows/ci-debug-macos-arm64.yml' + - 'TeXmacs/tests/*.scm' + - 'TeXmacs/progs/**' + - 'TeXmacs/plugins/**' + - '3rdparty/**' + pull_request: + branches: [ main ] + paths: + - 'src/**' + - '!src/Plugins/Windows/**' + - 'tests/**' + - 'xmake.lua' + - 'xmake/packages.lua' + - 'xmake/research.lua' + - 'xmake/options.lua' + - 'xmake/requires.lua' + - 'xmake/targets/**' + - 'xmake/packages/**' + - 'xmake-requires.lock' + - 'lolly/Data/**' + - 'lolly/Kernel/**' + - 'lolly/Plugins/**' + - 'lolly/System/**' + - 'lolly/lolly/**' + - 'lolly/tests/**' + - 'lolly/xmake.lua' + - 'moebius/Data/**' + - 'moebius/Kernel/**' + - 'moebius/Scheme/**' + - 'moebius/moebius/**' + - 'moebius/tests/**' + - 'moebius/xmake.lua' + - '.github/workflows/ci-debug-macos-arm64.yml' + - 'TeXmacs/tests/*.scm' + - 'TeXmacs/progs/**' + - 'TeXmacs/plugins/**' + - '3rdparty/**' + +jobs: + macosbuild: + strategy: + matrix: + os: [macos-14] + arch: [arm64] + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + if: always() + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: cache xmake + uses: actions/cache@v4 + with: + path: | + ${{github.workspace}}/build/.build_cache + /Users/runner/.xmake + key: xmake-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} + + - name: set XMAKE_GLOBALDIR + run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV + + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: v3.0.4 + actions-cache-folder: '.xmake-cache' + + - name: xmake repo --update + run: xmake repo --update + + - name: cache packages from xrepo + uses: actions/cache@v4 + with: + path: | + ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} + + - name: config + run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes + - name: build moebius + run: xmake build --yes -vD libmoebius + - name: test moebius + run: xmake test-with-log + + # - name: integration test + # run: xmake run --yes -vD --group=integration_tests + # env: + # QT_QPA_PLATFORM: offscreen diff --git a/moebius/xmake.lua b/moebius/xmake.lua index add29714a1..1b805c93a8 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -142,3 +142,34 @@ cpp_bench_on_all_plat = os.files("bench/**_bench.cpp") for _, filepath in ipairs(cpp_bench_on_all_plat) do add_bench_target (filepath) end + + + +task("test-with-log") + set_menu { + usage = "xmake test-with-log", + description = "Run tests and print stdout/stderr when tests fail" + } + + on_run(function () + local result = os.exec("xmake test -vD \"moebius_tests/*\"") + if result == 0 then + return + end + print("") + print("========== TEST LOGS ==========") + local stdout_logs = os.files("build/.gens/**/**/*.stdout.log") + local stderr_logs = os.files("build/.gens/**/**/*.errors.log") + + for _, file in ipairs(stdout_logs) do + print("") + print("========== " .. file .. " ==========") + os.execv("cat", {file}) + end + + for _, file in ipairs(stderr_logs) do + print("") + print("========== " .. file .. " ==========") + os.execv("cat", {file}) + end + end) \ No newline at end of file From c3a897cb7125744e21ea990a908d25edf664b999 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:12:10 +0800 Subject: [PATCH 02/11] debug --- .github/workflows/ci-debug-macos-arm64.yml | 6 +-- moebius/xmake.lua | 44 +++++++++++++++++----- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index c2ca534c9f..02edcbec15 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -1,4 +1,4 @@ -name: Build and Test on macOS arm64 +name: Build and Test moebius on macOS arm64 on: push: @@ -106,8 +106,8 @@ jobs: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} - - name: config - run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes +# - name: config +# run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes - name: build moebius run: xmake build --yes -vD libmoebius - name: test moebius diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 1b805c93a8..d348f5e4ef 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -143,33 +143,57 @@ for _, filepath in ipairs(cpp_bench_on_all_plat) do add_bench_target (filepath) end - - task("test-with-log") set_menu { usage = "xmake test-with-log", - description = "Run tests and print stdout/stderr when tests fail" + description = "Run tests and print stdout/stderr on failure" } on_run(function () - local result = os.exec("xmake test -vD \"moebius_tests/*\"") - if result == 0 then + local failed = false + + try + { + function () + os.execv("xmake", { + "test", + "-vD", + "moebius_tests/*" + }) + end, + + catch + { + function (errors) + failed = true + end + } + } + + if not failed then return end + print("") - print("========== TEST LOGS ==========") - local stdout_logs = os.files("build/.gens/**/**/*.stdout.log") - local stderr_logs = os.files("build/.gens/**/**/*.errors.log") + print("========================================") + print("TEST FAILED - DUMPING TEST LOGS") + print("========================================") + + local stdout_logs = os.files("build/.gens/**.stdout.log") + local stderr_logs = os.files("build/.gens/**.errors.log") for _, file in ipairs(stdout_logs) do print("") - print("========== " .. file .. " ==========") + print("========== stdout: " .. file .. " ==========") os.execv("cat", {file}) end for _, file in ipairs(stderr_logs) do print("") - print("========== " .. file .. " ==========") + print("========== stderr: " .. file .. " ==========") os.execv("cat", {file}) end + + -- Keep the task failed. + os.raise("tests failed") end) \ No newline at end of file From aab2a717fc9e9bd05c450b0f756c29717c1d59e1 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:16:43 +0800 Subject: [PATCH 03/11] debug1 --- .github/workflows/ci-debug-macos-arm64.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index 02edcbec15..b7559ac10c 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -106,8 +106,8 @@ jobs: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} -# - name: config -# run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes + - name: config + run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes - name: build moebius run: xmake build --yes -vD libmoebius - name: test moebius From 31e949052d3fef69bc0a892d8445d53507a1feb5 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:27:04 +0800 Subject: [PATCH 04/11] debug2 --- .github/workflows/ci-debug-macos-arm64.yml | 2 +- moebius/tests/Data/loro_tmu_test.cpp | 2 +- moebius/xmake.lua | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index b7559ac10c..13ee7724c0 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -107,7 +107,7 @@ jobs: key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} - name: config - run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --yes + run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --pdfhummus=no --yes - name: build moebius run: xmake build --yes -vD libmoebius - name: test moebius diff --git a/moebius/tests/Data/loro_tmu_test.cpp b/moebius/tests/Data/loro_tmu_test.cpp index 37914cdad4..f4d3d3c8b2 100644 --- a/moebius/tests/Data/loro_tmu_test.cpp +++ b/moebius/tests/Data/loro_tmu_test.cpp @@ -34,7 +34,7 @@ ensure_labels () { static string resolve_fixture_dir () { const char* cands[]= { - "../../../../TeXmacs/tests/tmu/", + "../../../TeXmacs/tests/tmu/", }; int n= sizeof (cands) / sizeof (cands[0]); for (int i= 0; i < n; i++) { diff --git a/moebius/xmake.lua b/moebius/xmake.lua index d348f5e4ef..6d18b85316 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -179,8 +179,18 @@ task("test-with-log") print("TEST FAILED - DUMPING TEST LOGS") print("========================================") - local stdout_logs = os.files("build/.gens/**.stdout.log") - local stderr_logs = os.files("build/.gens/**.errors.log") + local builddir = get_config("builddir") + if not builddir then + builddir = path.join(os.projectdir(), "build") + end + print("builddir: " .. builddir) + + local stdout_logs = os.files( + path.join(builddir, ".gens/**.stdout.log") + ) + local stderr_logs = os.files( + path.join(builddir, ".gens/**.errors.log") + ) for _, file in ipairs(stdout_logs) do print("") From 941e4f3d37f3e41036121c6aa67cbb4a2b0cb366 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:39:32 +0800 Subject: [PATCH 05/11] debug3 --- moebius/xmake.lua | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 6d18b85316..6aec80a49d 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -183,27 +183,46 @@ task("test-with-log") if not builddir then builddir = path.join(os.projectdir(), "build") end + + builddir = path.absolute(builddir) + print("builddir: " .. builddir) + -- Xmake test reports names such as: + -- + -- moebius_tests/loro_tmu_test + -- + -- The corresponding .gens directory is: + -- + -- .gens/moebius_tests_loro_tmu_test + -- + local test_name = "loro_tmu_test" + + local test_gendir = path.join( + builddir, + ".gens", + "moebius_tests_" .. test_name + ) + local stdout_logs = os.files( - path.join(builddir, ".gens/**.stdout.log") + path.join(test_gendir, "**/" .. test_name .. ".stdout.log") ) + local stderr_logs = os.files( - path.join(builddir, ".gens/**.errors.log") + path.join(test_gendir, "**/" .. test_name .. ".errors.log") ) for _, file in ipairs(stdout_logs) do print("") print("========== stdout: " .. file .. " ==========") - os.execv("cat", {file}) + print(io.readfile(file)) end for _, file in ipairs(stderr_logs) do print("") print("========== stderr: " .. file .. " ==========") - os.execv("cat", {file}) + print(io.readfile(file)) end - -- Keep the task failed. os.raise("tests failed") end) \ No newline at end of file From 97303d58d622bf471b845c17aa6e4a4872580a09 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:47:05 +0800 Subject: [PATCH 06/11] debug4 --- moebius/tests/Data/loro_tmu_test.cpp | 2 +- moebius/xmake.lua | 61 +++++++++------------------- 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/moebius/tests/Data/loro_tmu_test.cpp b/moebius/tests/Data/loro_tmu_test.cpp index f4d3d3c8b2..37914cdad4 100644 --- a/moebius/tests/Data/loro_tmu_test.cpp +++ b/moebius/tests/Data/loro_tmu_test.cpp @@ -34,7 +34,7 @@ ensure_labels () { static string resolve_fixture_dir () { const char* cands[]= { - "../../../TeXmacs/tests/tmu/", + "../../../../TeXmacs/tests/tmu/", }; int n= sizeof (cands) / sizeof (cands[0]); for (int i= 0; i < n; i++) { diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 6aec80a49d..483776dea1 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -164,7 +164,7 @@ task("test-with-log") catch { - function (errors) + function () failed = true end } @@ -179,49 +179,28 @@ task("test-with-log") print("TEST FAILED - DUMPING TEST LOGS") print("========================================") - local builddir = get_config("builddir") - if not builddir then - builddir = path.join(os.projectdir(), "build") - end + local stdout_log = + path.absolute("../build/.gens/moebius_tests_loro_tmu_test/macosx/arm64/releasedbg/tests/moebius_tests/loro_tmu_test.stdout.log") + + local stderr_log = + path.absolute("../build/.gens/moebius_tests_loro_tmu_test/macosx/arm64/releasedbg/tests/moebius_tests/loro_tmu_test.errors.log") + + print("") + print("========== stdout: " .. stdout_log .. " ==========") - builddir = path.absolute(builddir) - - print("builddir: " .. builddir) - - -- Xmake test reports names such as: - -- - -- moebius_tests/loro_tmu_test - -- - -- The corresponding .gens directory is: - -- - -- .gens/moebius_tests_loro_tmu_test - -- - local test_name = "loro_tmu_test" - - local test_gendir = path.join( - builddir, - ".gens", - "moebius_tests_" .. test_name - ) - - local stdout_logs = os.files( - path.join(test_gendir, "**/" .. test_name .. ".stdout.log") - ) - - local stderr_logs = os.files( - path.join(test_gendir, "**/" .. test_name .. ".errors.log") - ) - - for _, file in ipairs(stdout_logs) do - print("") - print("========== stdout: " .. file .. " ==========") - print(io.readfile(file)) + if os.isfile(stdout_log) then + print(io.readfile(stdout_log)) + else + print("stdout log not found") end - for _, file in ipairs(stderr_logs) do - print("") - print("========== stderr: " .. file .. " ==========") - print(io.readfile(file)) + print("") + print("========== stderr: " .. stderr_log .. " ==========") + + if os.isfile(stderr_log) then + print(io.readfile(stderr_log)) + else + print("stderr log not found") end os.raise("tests failed") From 12341e4de3736dd640ed124cba6fbd6a8a78643c Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 13:56:36 +0800 Subject: [PATCH 07/11] debug5 --- moebius/tests/Data/loro_tmu_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/moebius/tests/Data/loro_tmu_test.cpp b/moebius/tests/Data/loro_tmu_test.cpp index 37914cdad4..4b82866abe 100644 --- a/moebius/tests/Data/loro_tmu_test.cpp +++ b/moebius/tests/Data/loro_tmu_test.cpp @@ -34,6 +34,10 @@ ensure_labels () { static string resolve_fixture_dir () { const char* cands[]= { + "TeXmacs/tests/tmu/", + "../TeXmacs/tests/tmu/", + "../../TeXmacs/tests/tmu/", + "../../../TeXmacs/tests/tmu/", "../../../../TeXmacs/tests/tmu/", }; int n= sizeof (cands) / sizeof (cands[0]); From 9126edf31583beba7f83fb9de14473cf496430a4 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 14:11:13 +0800 Subject: [PATCH 08/11] debug5 --- moebius/tests/Data/loro_tmu_test.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/moebius/tests/Data/loro_tmu_test.cpp b/moebius/tests/Data/loro_tmu_test.cpp index 4b82866abe..00fc2f5168 100644 --- a/moebius/tests/Data/loro_tmu_test.cpp +++ b/moebius/tests/Data/loro_tmu_test.cpp @@ -39,12 +39,34 @@ resolve_fixture_dir () { "../../TeXmacs/tests/tmu/", "../../../TeXmacs/tests/tmu/", "../../../../TeXmacs/tests/tmu/", + "../../../../../TeXmacs/tests/tmu/", + "../../../../../../TeXmacs/tests/tmu/", + "../../../../../../../TeXmacs/tests/tmu/", }; + + cout << "========== resolve_fixture_dir ==========" << LF; + int n= sizeof (cands) / sizeof (cands[0]); + for (int i= 0; i < n; i++) { string c= cands[i]; - if (is_directory (c)) return c; + + cout << "candidate[" << i << "]: " << c << LF; + + bool exists= is_directory (c); + + cout << " is_directory: " << (exists ? "true" : "false") << LF; + + if (exists) { + cout << " >>> FOUND: " << c << LF; + cout << "=========================================" << LF; + return c; + } } + + cout << " >>> NO FIXTURE DIRECTORY FOUND" << LF; + cout << "=========================================" << LF; + return string (); } From a0aa621990be312c24a921f8ee46f4646f13907f Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 14:20:46 +0800 Subject: [PATCH 09/11] debug6 --- .github/workflows/ci-debug-macos-arm64.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index 13ee7724c0..ed5d4ea4b1 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -76,6 +76,26 @@ jobs: timeout-minutes: 45 if: always() steps: + - name: debug checkout + run: | + echo "PWD:" + pwd + + echo "Workspace:" + echo "${{ github.workspace }}" + + echo "TeXmacs:" + ls -la TeXmacs || true + + echo "TeXmacs/tests:" + ls -la TeXmacs/tests || true + + echo "tmu:" + ls -la TeXmacs/tests/tmu || true + + echo "git tracked tmu files:" + git ls-files 'TeXmacs/tests/tmu/**' | head -20 + - uses: actions/checkout@v4 with: fetch-depth: 1 From 8abf4ae4f909ac84bf94509355e2eb038d58e7ef Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 14:22:05 +0800 Subject: [PATCH 10/11] debug7 --- .github/workflows/ci-debug-macos-arm64.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index ed5d4ea4b1..c60f75bbaa 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -76,6 +76,10 @@ jobs: timeout-minutes: 45 if: always() steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: debug checkout run: | echo "PWD:" @@ -96,10 +100,6 @@ jobs: echo "git tracked tmu files:" git ls-files 'TeXmacs/tests/tmu/**' | head -20 - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: cache xmake uses: actions/cache@v4 with: From aa8111f59f59d572a77d59977cc2e4e2b473e70e Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 10 Aug 2026 14:27:00 +0800 Subject: [PATCH 11/11] ci --- .github/workflows/ci-debug-macos-arm64.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml index c60f75bbaa..932438b93b 100644 --- a/.github/workflows/ci-debug-macos-arm64.yml +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -1,6 +1,13 @@ name: Build and Test moebius on macOS arm64 on: + workflow_dispatch: + inputs: + commit: + description: 'Commit SHA to build/test' + required: true + type: string + push: branches: [ main ] paths: @@ -78,6 +85,7 @@ jobs: steps: - uses: actions/checkout@v4 with: + ref: ${{ inputs.commit || github.sha }} fetch-depth: 1 - name: debug checkout