Skip to content

Commit

Permalink
Test scripts: Allow options to be passed as args
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenthuberdeau committed Aug 29, 2024
1 parent d7bdf70 commit 133653e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions bootstrap-pnut-exe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ set -e -u

TEMP_DIR="bootstrap-results"

PNUT_EXE_OPTIONS= # Set by the backend option
PNUT_SH_OPTIONS="-DRT_NO_INIT_GLOBALS -Dsh"
: ${PNUT_OPTIONS:=} # Default to empty options

PNUT_EXE_OPTIONS="${PNUT_OPTIONS" # Backend is set by the backend option
PNUT_SH_OPTIONS="$PNUT_OPTIONS -DRT_NO_INIT_GLOBALS -Dsh"
PNUT_SH_OPTIONS_FAST="$PNUT_SH_OPTIONS -DSH_SAVE_VARS_WITH_SET -DOPTIMIZE_CONSTANT_PARAM"
if [ ! -d "$TEMP_DIR" ]; then mkdir "$TEMP_DIR"; fi
Expand Down Expand Up @@ -131,7 +133,7 @@ done
case $backend in
x86_64_mac | x86_64_linux | i386_linux)
PNUT_EXE_OPTIONS="-Dtarget_$backend" ;;
PNUT_EXE_OPTIONS="$PNUT_EXE_OPTIONS -Dtarget_$backend" ;;
*)
echo "Unknown backend: $backend"
echo "Supported backends: x86_64_mac x86_64_linux i386_linux"
Expand Down
4 changes: 3 additions & 1 deletion bootstrap-pnut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

set -e

: ${PNUT_OPTIONS:=} # Default to empty options

TEMP_DIR="bootstrap-results"
PNUT_SH_OPTIONS="-DRT_NO_INIT_GLOBALS -Dsh"
PNUT_SH_OPTIONS="$PNUT_OPTIONS -DRT_NO_INIT_GLOBALS -Dsh"
PNUT_SH_OPTIONS_FAST="$PNUT_SH_OPTIONS -DSH_SAVE_VARS_WITH_SET -DOPTIMIZE_CONSTANT_PARAM"

bootstrap_with_shell() {
Expand Down
5 changes: 3 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if [ $# -lt 1 ]; then
fi

# Parse the arguments
: ${PNUT_OPTIONS:=} # Default to empty options
backend=$1; shift
bootstrap=0
shell="$SHELL" # Use current shell as the default
Expand All @@ -31,11 +32,11 @@ done
case "$backend" in
sh)
ext="exe" # The extension doesn't matter for sh
PNUT_EXE_OPTIONS="-Dsh -DRT_NO_INIT_GLOBALS"
PNUT_EXE_OPTIONS="$PNUT_OPTIONS -Dsh -DRT_NO_INIT_GLOBALS"
;;
i386_linux | x86_64_linux | x86_64_mac)
ext="exe"
PNUT_EXE_OPTIONS="-Dtarget_$backend"
PNUT_EXE_OPTIONS="$PNUT_OPTIONS -Dtarget_$backend"
;;
*)
echo "Unknown backend: $backend"
Expand Down

0 comments on commit 133653e

Please sign in to comment.