Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 committed Jan 10, 2024
1 parent 4a1a5ee commit 321d8ff
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .lldbinit
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
26 changes: 26 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 321d8ff

Please sign in to comment.