From 83361e4a9bfae363f86e0655b35d613f5e9efd9f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Dec 2022 19:27:35 -0700 Subject: [PATCH] CI: test updating the wasm binary Make sure that no commit regresses the ability to upgrade our wasm binary. Otherwise, somebody in the future is going to have a Bad Day. --- ci/aarch64-linux-debug.sh | 27 +++++++++++++++++++++++++++ ci/aarch64-linux-release.sh | 27 +++++++++++++++++++++++++++ ci/x86_64-linux-debug.sh | 27 +++++++++++++++++++++++++++ ci/x86_64-linux-release.sh | 28 ++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) diff --git a/ci/aarch64-linux-debug.sh b/ci/aarch64-linux-debug.sh index 05cdcdd0787afc1b2e83baa8fb182ac354e18701..0452b7d7dd8c5a60cc82c275aa3758cca861d430 100644 --- a/ci/aarch64-linux-debug.sh +++ b/ci/aarch64-linux-debug.sh @@ -71,3 +71,30 @@ tidy --drop-empty-elements no -qe ../zig-cache/langref.html # Produce the experimental std lib documentation. stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib + +# Ensure that updating the wasm binary from this commit will result in a viable build. +stage3-debug/bin/zig build update-zig1 + +rm -rf ../build-new +mkdir ../build-new +cd ../build-new + +export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +cmake .. \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +unset CC +unset CXX + +ninja install + +stage3/bin/zig test ../test/behavior.zig -I../test diff --git a/ci/aarch64-linux-release.sh b/ci/aarch64-linux-release.sh index b74ce134501a64dacf3045a7a1f749a767b8091e..ef24accda46667a33acf8a36c42812965636cb6d 100644 --- a/ci/aarch64-linux-release.sh +++ b/ci/aarch64-linux-release.sh @@ -71,3 +71,30 @@ tidy --drop-empty-elements no -qe ../zig-cache/langref.html # Produce the experimental std lib documentation. stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib + +# Ensure that updating the wasm binary from this commit will result in a viable build. +stage3-release/bin/zig build update-zig1 + +rm -rf ../build-new +mkdir ../build-new +cd ../build-new + +export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +cmake .. \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +unset CC +unset CXX + +ninja install + +stage3/bin/zig test ../test/behavior.zig -I../test diff --git a/ci/x86_64-linux-debug.sh b/ci/x86_64-linux-debug.sh index 3d904c38cc1f7e1a5a9378cb85c3b7c0e6c03420..6ee2ce9b89e4b9f76b27bf026f13d11ee1e5c163 100755 --- a/ci/x86_64-linux-debug.sh +++ b/ci/x86_64-linux-debug.sh @@ -70,3 +70,30 @@ tidy --drop-empty-elements no -qe ../zig-cache/langref.html # Produce the experimental std lib documentation. stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib + +# Ensure that updating the wasm binary from this commit will result in a viable build. +stage3-debug/bin/zig build update-zig1 + +rm -rf ../build-new +mkdir ../build-new +cd ../build-new + +export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +cmake .. \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +unset CC +unset CXX + +ninja install + +stage3/bin/zig test ../test/behavior.zig -I../test diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh index c87a3cb32b0f1b3259786361f58ce8431eedc120..d9c1172b0411910b628a62725e9c43092b7fe42b 100755 --- a/ci/x86_64-linux-release.sh +++ b/ci/x86_64-linux-release.sh @@ -72,6 +72,7 @@ tidy --drop-empty-elements no -qe ../zig-cache/langref.html # Produce the experimental std lib documentation. stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib +# Ensure that stage3 and stage4 are byte-for-byte identical. stage3-release/bin/zig build \ --prefix stage4-release \ -Denable-llvm \ @@ -86,3 +87,30 @@ stage3-release/bin/zig build \ echo "If the following command fails, it means nondeterminism has been" echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." diff stage3-release/bin/zig stage4-release/bin/zig + +# Ensure that updating the wasm binary from this commit will result in a viable build. +stage3-release/bin/zig build update-zig1 + +rm -rf ../build-new +mkdir ../build-new +cd ../build-new + +export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +cmake .. \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +unset CC +unset CXX + +ninja install + +stage3/bin/zig test ../test/behavior.zig -I../test -- 2.54.0