diff --git a/CMakeLists.txt b/CMakeLists.txt index b3834a7..abe3072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,7 +237,12 @@ foreach(t ${_CST_SMALL_TESTS}) elseif(t STREQUAL test_json_baseline) add_executable(${t} tests/${t}.c src/json_baseline.c vendor/cjson/cJSON.c) elseif(t STREQUAL test_replay_starvation OR t STREQUAL test_replay_real) - add_executable(${t} tests/${t}.c src/ctl_parse.c src/json_baseline.c vendor/cjson/cJSON.c) + # cst_test_util.h static helpers reference os_*; gcc -O0 keeps unused ones + add_executable(${t} tests/${t}.c src/ctl_parse.c src/json_baseline.c + vendor/cjson/cJSON.c src/os_compat.c src/os_win.c) + if(WIN32) + target_link_libraries(${t} PRIVATE advapi32 user32) + endif() else() add_executable(${t} tests/test_mm_tool.c src/mm_tool.c) endif() diff --git a/scripts/ci_windows_cross.sh b/scripts/ci_windows_cross.sh index f1b6308..1f1cecf 100755 --- a/scripts/ci_windows_cross.sh +++ b/scripts/ci_windows_cross.sh @@ -19,17 +19,25 @@ fi if [[ ! -x "$DIR/bin/x86_64-w64-mingw32-gcc" ]]; then echo "==> download $NAME" + # Prefer CN-reachable GitHub proxies; raw github.com is often unreachable. urls=( + "https://ghfast.top/https://github.com/mstorsjo/llvm-mingw/releases/download/${VER}/${NAME}.tar.xz" + "https://ghproxy.net/https://github.com/mstorsjo/llvm-mingw/releases/download/${VER}/${NAME}.tar.xz" "https://gitclone.com/github.com/mstorsjo/llvm-mingw/releases/download/${VER}/${NAME}.tar.xz" - "https://mirror.ghproxy.com/https://github.com/mstorsjo/llvm-mingw/releases/download/${VER}/${NAME}.tar.xz" "https://github.com/mstorsjo/llvm-mingw/releases/download/${VER}/${NAME}.tar.xz" ) ok=0 for u in "${urls[@]}"; do echo " try $u" - if curl -fL --retry 2 --connect-timeout 20 --retry-delay 2 -o "$TGZ" "$u"; then - ok=1 - break + if curl -fL --retry 2 --connect-timeout 15 --max-time 600 \ + --retry-delay 2 -o "$TGZ" "$u"; then + # Reject tiny error pages that some proxies return with HTTP 200. + sz=$(wc -c <"$TGZ") + if [[ "$sz" -gt 10000000 ]]; then + ok=1 + break + fi + echo " too small ($sz bytes), next mirror" fi done [[ $ok -eq 1 ]] || { echo "failed to download llvm-mingw" >&2; exit 1; }