@@ -255,6 +255,10 @@ jobs:
255255 mkdir -p "$RUNNER_TEMP/out"
256256 git -C "$RUNNER_TEMP/okl" rev-parse HEAD > "$RUNNER_TEMP/out/source-sha.txt"
257257 echo "openkal-llvm-runtime source SHA: $(cat "$RUNNER_TEMP/out/source-sha.txt")"
258+ python3 - "$GITHUB_WORKSPACE/tests/fixtures/openkal-hosted-threads/src/main.cpp" "$RUNNER_TEMP/out/threads-source-sha256.txt" <<'PYHASH'
259+ import hashlib, pathlib, sys
260+ pathlib.Path(sys.argv[2]).write_text(hashlib.sha256(pathlib.Path(sys.argv[1]).read_bytes()).hexdigest() + "\n")
261+ PYHASH
258262 BIN="${MCPP_HOME:-$HOME/.mcpp}/registry/data/xpkgs/xim-x-llvm/23.1.3/bin"
259263 READOBJ="$BIN/llvm-readobj"
260264 [ -x "$READOBJ" ] || READOBJ="$BIN/llvm-readobj.exe"
@@ -284,6 +288,18 @@ jobs:
284288 || { echo "::error::$t emitted the wrong architecture"; cat "$RUNNER_TEMP/out/$t.headers.txt"; exit 1; }
285289 echo "${{ matrix.host }} → $t : $(ls -l "$a" | awk '{print $5}') bytes"
286290 cat "$RUNNER_TEMP/out/$t.headers.txt"
291+ MCPP="$MCPP_UNDER_TEST" LLVM_TOOLCHAIN=llvm@23.1.3 \
292+ bash "$GITHUB_WORKSPACE/.github/tools/check_openkal_hosted_threads.sh" \
293+ "$RUNNER_TEMP/okl" "$t" "$RUNNER_TEMP/threads-binary.txt"
294+ thread_bin=$(cat "$RUNNER_TEMP/threads-binary.txt")
295+ case "$t" in
296+ x86_64-windows-gnu) thread_output=windows-threads.exe ;;
297+ aarch64-macos) thread_output=macos-threads ;;
298+ *) thread_output=linux-threads ;;
299+ esac
300+ cp "$thread_bin" "$RUNNER_TEMP/out/$thread_output"
301+ "$READOBJ" --file-headers "$thread_bin" > "$RUNNER_TEMP/out/$t.threads.headers.txt"
302+ grep -q "Arch: $arch" "$RUNNER_TEMP/out/$t.threads.headers.txt"
287303 done
288304
289305 # THE ONLY CRITERION THE `builtins` TOKEN HAS, AND WHY IT IS HERE.
@@ -442,6 +458,8 @@ jobs:
442458 set -euo pipefail
443459 fail=0
444460 source_sha=""
461+ threads_sha=""
462+ mkdir -p run-evidence
445463 for host in linux linux-aarch64 macos windows; do
446464 sha_file="art/openkal-built-on-$host/source-sha.txt"
447465 if [ ! -f "$sha_file" ]; then
@@ -456,6 +474,10 @@ jobs:
456474 echo "::error::$host built source $sha, expected $source_sha"; fail=1; continue
457475 fi
458476 echo "openkal-llvm-runtime source SHA: $sha"
477+ probe_sha=$(tr -d '\r\n' < "art/openkal-built-on-$host/threads-source-sha256.txt")
478+ [[ "$probe_sha" =~ ^[0-9a-f]{64}$ ]] || { echo '::error::invalid hosted probe digest'; exit 1; }
479+ if [ -z "$threads_sha" ]; then threads_sha="$probe_sha"; fi
480+ [ "$probe_sha" = "$threads_sha" ] || { echo '::error::hosted probe sources differ'; exit 1; }
459481 bin="art/openkal-built-on-$host/${{ matrix.file }}"
460482 echo "──────── built on $host, running on ${{ matrix.system }} ────────"
461483 if [ ! -f "$bin" ]; then
@@ -474,16 +496,36 @@ jobs:
474496 echo "::error::built on $host: it did not run"; cat out.log; fail=1; continue
475497 fi
476498 cat out.log
499+ cp out.log "run-evidence/$host.same-source.log"
477500 ok=1
478501 grep -q 'sorted: 2 4 7' out.log || ok=0
479502 grep -q 'caught: 42' out.log || ok=0
480503 # The line a link cannot fake.
481504 grep -q 'unwound: true' out.log || ok=0
482505 grep -q 'import std over openkal: ok' out.log || ok=0
483506 [ "$ok" = 1 ] || { echo "::error::built on $host: wrong output"; fail=1; }
507+ case "${{ matrix.system }}" in
508+ windows) threads_file=windows-threads.exe ;;
509+ *) threads_file="${{ matrix.system }}-threads" ;;
510+ esac
511+ threads_bin="art/openkal-built-on-$host/$threads_file"
512+ chmod +x "$threads_bin"
513+ if [ "${{ matrix.system }}" = macos ]; then
514+ codesign -dv "$threads_bin" 2>&1 | grep -q 'adhoc\|Signature'
515+ fi
516+ "./$threads_bin" > "run-evidence/$host.threads.log" 2>&1
517+ cat "run-evidence/$host.threads.log"
518+ grep -qxF 'openkal hosted threads: isolation, destructors and concurrent unwind ok' "run-evidence/$host.threads.log"
484519 done
485520 [ "$fail" = 0 ] || exit 1
486- echo "four builds, one system, same source SHA and four lines"
521+ echo "four builds, one system, identical sources, exceptions and hosted TLS/threads"
522+
523+ - uses : actions/upload-artifact@v4
524+ if : always()
525+ with :
526+ name : openkal-target-execution-${{ matrix.system }}
527+ path : run-evidence/*.log
528+ if-no-files-found : warn
487529
488530 # ──────────────────────────────────────────────────────────────────
489531 # The e2e scripts that BUILD the openkal ecosystem, on a runner that
@@ -695,6 +737,7 @@ jobs:
695737 bash tests/e2e/286_the_openkal_stack_still_builds.sh 2>&1 | tee native-openkal.log
696738 grep -qF "ok native aarch64 ELF" native-openkal.log
697739 grep -qF "OK: the openkal stack builds, links statically and runs" native-openkal.log
740+ grep -qxF 'openkal hosted threads: isolation, destructors and concurrent unwind ok' native-openkal.log
698741
699742 - uses : actions/upload-artifact@v4
700743 if : always()
0 commit comments