motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit e9a12491f6fe5e38a05eeef0e920f2dec23634a4 (tree)
parent 8c4faa5f3f63cfbcfdc12cda7c37be1da642d2f6
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Thu,  3 Nov 2022 17:48:05 -0700

CI: add stage3/stage4 determinism check

Makes sure that #12183 will not regress.

Diffstat:
Mci/zinc/drone.yml | 8++++++++
Aci/zinc/linux_test_determinism | 28++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/ci/zinc/drone.yml b/ci/zinc/drone.yml @@ -35,10 +35,18 @@ steps: commands: - ./ci/zinc/build_aarch64_macos +- name: test_determinism + depends_on: + - test_stage3_release + image: ci/debian-amd64:11.1-12 + commands: + - ./ci/zinc/linux_test_determinism + - name: linux_package depends_on: - test_stage3_debug - test_stage3_release + - test_determinism when: branch: - master diff --git a/ci/zinc/linux_test_determinism b/ci/zinc/linux_test_determinism @@ -0,0 +1,28 @@ +#!/bin/sh + +set -x +set -e + +DEPS_LOCAL="/deps/local" +ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging" +VERSION=$($ZIG_PREFIX/bin/zig version) + +"$ZIG_PREFIX/bin/zig" build \ + --prefix stage4 \ + -Dconfig_h="build-release/config.h" \ + -Denable-llvm \ + -Denable-stage1 \ + -Dno-lib \ + -Drelease \ + -Dstrip \ + -Dtarget=x86_64-linux-musl \ + -Duse-zig-libcxx \ + -Dversion-string="$VERSION" + +# diff returns an error code if the files differ. +echo "If the following command fails, it means nondeterminism has been" +echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." +diff "$ZIG_PREFIX/bin/zig" "stage4/bin/zig" + +# Explicit exit helps show last command duration. +exit