diff --git a/.lldbinit b/.lldbinit new file mode 100644 index 000000000000..7cea5ce79cdb --- /dev/null +++ b/.lldbinit @@ -0,0 +1,5 @@ +command script import ~/prg/zig/0/tools/lldb_pretty_printers.py +type category enable zig.stage2 zig.std zig +type summary add --inline-children arch.x86_64.CodeGen.FrameAddr +type summary add --inline-children arch.x86_64.CodeGen.RegisterOffset +type summary add --inline-children arch.x86_64.CodeGen.InstTracking diff --git a/build.sh b/build.sh new file mode 100755 index 000000000000..71d5fe827d76 --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e +build=build +if [ "x$1" != x--debug ]; then + cmake -GNinja -S. -B$build -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=clang -DCMAKE_CXX_COMPILER:FILEPATH=clang++ -DZIG_NO_LIB:BOOL=ON + cmake --build $build + cmake --install $build +else + shift +fi +$build/stage3/bin/zig build -p debug -Dno-lib -Denable-llvm "$@" diff --git a/test.sh b/test.sh new file mode 100755 index 000000000000..d30a3614b225 --- /dev/null +++ b/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +if [[ $1 == --behavior-c ]]; then + shift + ./build.sh --debug && debug/bin/zig test -Itest test/behavior.zig -ofmt=c "$@" +elif [[ $1 == --enable-fixed-behavior ]]; then + backend=$2 + shift 2 + declare -A offsets + git grep --no-index --line-number stage2_$backend test/behavior | while read -r match; do + printf '\e[36mTrying to enable... %s\e[m\n' "$match" + file=`cut -d: -f1 <<<"$match"` + offset=${offsets[$file]:=0} + echo "match = \"$match\"" + let line=`cut -d: -f2 <<<"$match"`-$offset + contents=`cut -d: -f3- <<<"$match"` + sed --in-place "${line}d" "$file" + if timeout 15s debug/bin/zig test -Itest test/behavior.zig "$@"; then + printf '\e[32mTest was enabled! :)\e[m\n' + let offsets[$file]+=1 + else + printf '\e[31mTest kept disabled. :(\e[m\n' + sed --in-place "${line}i\\ +$contents" "$file" + fi + done +fi