mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 15:43:06 +00:00
* test/link: initial wasm support This adds basic parsing and dumping of wasm section so they can be tested using the new linker-test infrastructure. * test/link: all wasm sections parsing and dumping We now parse and dump all sections for the wasm binary format. Currently, this only dumps the name of a custom section. Later this should also dump symbol table, name, linking metadata and relocations. All of those live within the custom sections. * Add wasm linker test This also fixes a parser mistake in reading the flags. * test/link: implement linker tests wasm & fixes Adds several test cases to test the wasm self-hosted linker. This also introduces fixes that were caught during the implementation of those tests. * test-runner: obey omit_stage2 for standalone When a standalone test requires stage2, but stage2 is omit from the compiler, such test case will not be included as part of the test suite that is being ran. This is to support CI's where we omit stage2 to lower the memory usage.
116 lines
4.0 KiB
Bash
Executable File
116 lines
4.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
brew update && brew install ncurses s3cmd
|
|
|
|
ZIGDIR="$(pwd)"
|
|
ARCH="x86_64"
|
|
TARGET="$ARCH-macos-none"
|
|
MCPU="baseline"
|
|
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.2931+bdf3fa12f"
|
|
PREFIX="$HOME/$CACHE_BASENAME"
|
|
JOBS="-j2"
|
|
|
|
rm -rf $PREFIX
|
|
cd $HOME
|
|
|
|
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
|
tar xf "$CACHE_BASENAME.tar.xz"
|
|
|
|
ZIG="$PREFIX/bin/zig"
|
|
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
|
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
|
|
|
cd $ZIGDIR
|
|
|
|
# Make the `zig version` number consistent.
|
|
# This will affect the cmake command below.
|
|
git config core.abbrev 9
|
|
git fetch --unshallow || true
|
|
git fetch --tags
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake .. \
|
|
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
|
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DZIG_TARGET_TRIPLE="$TARGET" \
|
|
-DZIG_TARGET_MCPU="$MCPU" \
|
|
-DZIG_STATIC=ON \
|
|
-DZIG_OMIT_STAGE2=ON
|
|
|
|
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
|
# so that installation and testing do not get affected by them.
|
|
unset CC
|
|
unset CXX
|
|
|
|
make $JOBS install
|
|
|
|
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
|
# build zig1.o rather than relying on the one built with stage0. See
|
|
# https://github.com/ziglang/zig/issues/6830 for more details.
|
|
cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"
|
|
make $JOBS install
|
|
|
|
# Build stage2 standalone so that we can test stage2 against stage2 compiler-rt.
|
|
release/bin/zig build -p stage2 -Denable-llvm
|
|
|
|
stage2/bin/zig build test-behavior
|
|
|
|
# TODO: upgrade these to test stage2 instead of stage1
|
|
# TODO: upgrade these to test stage3 instead of stage2
|
|
release/bin/zig build test-behavior -Denable-macos-sdk -Domit-stage2
|
|
release/bin/zig build test-compiler-rt -Denable-macos-sdk
|
|
release/bin/zig build test-std -Denable-macos-sdk
|
|
release/bin/zig build test-universal-libc -Denable-macos-sdk
|
|
release/bin/zig build test-compare-output -Denable-macos-sdk
|
|
release/bin/zig build test-standalone -Denable-macos-sdk
|
|
release/bin/zig build test-stack-traces -Denable-macos-sdk
|
|
release/bin/zig build test-cli -Denable-macos-sdk
|
|
release/bin/zig build test-asm-link -Denable-macos-sdk
|
|
release/bin/zig build test-translate-c -Denable-macos-sdk
|
|
release/bin/zig build test-run-translated-c -Denable-macos-sdk
|
|
release/bin/zig build docs -Denable-macos-sdk
|
|
release/bin/zig build test-fmt -Denable-macos-sdk
|
|
release/bin/zig build test-cases -Denable-macos-sdk -Dsingle-threaded
|
|
release/bin/zig build test-link -Denable-macos-sdk -Domit-stage2
|
|
|
|
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
|
mv ../LICENSE release/
|
|
mv ../zig-cache/langref.html release/
|
|
mv release/bin/zig release/
|
|
rmdir release/bin
|
|
|
|
VERSION=$(release/zig version)
|
|
DIRNAME="zig-macos-$ARCH-$VERSION"
|
|
TARBALL="$DIRNAME.tar.xz"
|
|
mv release "$DIRNAME"
|
|
tar cfJ "$TARBALL" "$DIRNAME"
|
|
|
|
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
|
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
|
|
|
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
|
|
BYTESIZE=$(wc -c < $TARBALL)
|
|
|
|
JSONFILE="macos-$GITBRANCH.json"
|
|
touch $JSONFILE
|
|
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
|
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
|
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
|
|
|
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
|
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-macos-$VERSION.json"
|
|
|
|
# `set -x` causes these variables to be mangled.
|
|
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
|
set +x
|
|
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
|
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
|
|
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
|
|
echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION"
|
|
fi
|