# Library of functions shared by all tests scripts, included by # test-lib.sh. # # Copyright (c) 2005 Junio C Hamano # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/ . # The semantics of the editor variables are that of invoking # sh -c "$EDITOR \"$@\"" files ... # # If our trash directory contains shell metacharacters, they will be # interpreted if we just set $EDITOR directly, so do a little dance with # environment variables to work around this. # # In particular, quoting isn't enough, as the path may contain the same quote # that we're using. proc test_set_editor { global FAKE_EDITOR := $1 export FAKE_EDITOR global EDITOR := ''"$FAKE_EDITOR"'' export EDITOR } proc test_set_index_version { global GIT_INDEX_VERSION := $1 export GIT_INDEX_VERSION } proc test_decode_color { awk ' function name(n) { if (n == 0) return "RESET"; if (n == 1) return "BOLD"; if (n == 30) return "BLACK"; if (n == 31) return "RED"; if (n == 32) return "GREEN"; if (n == 33) return "YELLOW"; if (n == 34) return "BLUE"; if (n == 35) return "MAGENTA"; if (n == 36) return "CYAN"; if (n == 37) return "WHITE"; if (n == 40) return "BLACK"; if (n == 41) return "BRED"; if (n == 42) return "BGREEN"; if (n == 43) return "BYELLOW"; if (n == 44) return "BBLUE"; if (n == 45) return "BMAGENTA"; if (n == 46) return "BCYAN"; if (n == 47) return "BWHITE"; } { while (match($0, /\033\[[0-9;]*m/) != 0) { printf "%s<", substr($0, 1, RSTART-1); codes = substr($0, RSTART+2, RLENGTH-3); if (length(codes) == 0) printf "%s", name(0) else { n = split(codes, ary, ";"); sep = ""; for (i = 1; i <= n; i++) { printf "%s%s", sep, name(ary[i]); sep = ";" } } printf ">"; $0 = substr($0, RSTART + RLENGTH, length($0) - RSTART - RLENGTH + 1); } print } ' } proc lf_to_nul { perl -pe 'y/\012/\000/' } proc nul_to_q { perl -pe 'y/\000/Q/' } proc q_to_nul { perl -pe 'y/Q/\000/' } proc q_to_cr { tr Q '\015' } proc q_to_tab { tr Q '\011' } proc qz_to_tab_space { tr QZ '\011\040' } proc append_cr { sed -e 's/$/Q/' | tr Q '\015' } proc remove_cr { tr '\015' Q | sed -e 's/Q$//' } # In some bourne shell implementations, the "unset" builtin returns # nonzero status when a variable to be unset was not set in the first # place. # # Use sane_unset when that should not be considered an error. proc sane_unset { unset @Argv return 0 } proc test_tick { if test -z $(test_tick+set) { global test_tick := '1112911993' } else { global test_tick := $($test_tick + 60) } global GIT_COMMITTER_DATE := ""$test_tick -0700"" global GIT_AUTHOR_DATE := ""$test_tick -0700"" export GIT_COMMITTER_DATE GIT_AUTHOR_DATE } # Stop execution and start a shell. This is useful for debugging tests and # only makes sense together with "-v". # # Be sure to remove all invocations of this command before submitting. proc test_pause { if test $verbose = t { $SHELL_PATH <&6 > !3 !2 > !4 } else { error >&5 "test_pause requires --verbose> !5 "test_pause requires --verbose" } } # Wrap git in gdb. Adding this to a command can make it easier to # understand what is going on in a failing test. # # Example: "debug git checkout master". proc debug { env GIT_TEST_GDB=1 @Argv } # Call test_commit with the arguments " [ [ []]]" # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. # # , , and all default to . proc test_commit { global notick := '' && global signoff := '' && while test $# != 0 { matchstr $1 { --notick { global notick := 'yes' } --signoff { global signoff := $1 } * { break } } shift } && global file := $(2:-"$1.t") && echo $(3-$1) > $file && git add $file && if test -z $notick { test_tick } && git commit $signoff -m $1 && git tag $(4:-$1) } # Call test_merge with the arguments " ", where # can be a tag pointing to the commit-to-merge. proc test_merge { test_tick && git merge -m $1 $2 && git tag $1 } # This function helps systems where core.filemode=false is set. # Use it instead of plain 'chmod +x' to set or unset the executable bit # of a file in the working directory and add it to the index. proc test_chmod { chmod @Argv && git update-index --add "--chmod=$ifsjoin(Argv)" } # Unset a configuration variable, but don't fail if it doesn't exist. proc test_unconfig { global config_dir := '' if test $1 = -C { shift global config_dir := $1 shift } git $(config_dir:+-C "$config_dir") config --unset-all @Argv global config_status := $Status matchstr $config_status { 5 { # ok, nothing to unset global config_status := '0' } } return $config_status } # Set git config, automatically unsetting it after the test is over. proc test_config { global config_dir := '' if test $1 = -C { shift global config_dir := $1 shift } test_when_finished "test_unconfig $(config_dir:+-C '$config_dir') '$1'" && git $(config_dir:+-C "$config_dir") config @Argv } proc test_config_global { test_when_finished "test_unconfig --global '$1'" && git config --global @Argv } proc write_script { do { echo "#!$(2-"$SHELL_PATH")" && cat } >"$1" && chmod +x $1 } # Use test_set_prereq to tell that a particular prerequisite is available. # The prerequisite can later be checked for in two ways: # # - Explicitly using test_have_prereq. # # - Implicitly by specifying the prerequisite tag in the calls to # test_expect_{success,failure,code}. # # The single parameter is the prerequisite tag (a simple word, in all # capital letters by convention). proc test_set_prereq { global satisfied_prereq := ""$satisfied_prereq$1 "" } global satisfied_prereq := '" '" global lazily_testable_prereq := '', lazily_tested_prereq := '' # Usage: test_lazy_prereq PREREQ 'script' proc test_lazy_prereq { global lazily_testable_prereq := ""$lazily_testable_prereq$1 "" eval test_prereq_lazily_$1='$'2 } proc test_run_lazy_prereq_ { global script := "' mkdir -p "$TRASH_DIRECTORY/prereq-test-dir" && ( cd "$TRASH_DIRECTORY/prereq-test-dir" &&'"$2"' )"' say >&3 "checking prerequisite: $1> !3 "checking prerequisite: $1" say >&3 $script> !3 "$script" test_eval_ $script global eval_ret := $Status rm -rf "$TRASH_DIRECTORY/prereq-test-dir" if test $eval_ret = 0 { say >&3 "prerequisite $1 ok> !3 "prerequisite $1 ok" } else { say >&3 "prerequisite $1 not satisfied> !3 "prerequisite $1 not satisfied" } return $eval_ret } proc test_have_prereq { # prerequisites can be concatenated with ',' global save_IFS := $IFS global IFS := ',' set -- $ifsjoin(Argv) global IFS := $save_IFS global total_prereq := '0' global ok_prereq := '0' global missing_prereq := ''for prerequisite in @Argv { matchstr $prerequisite { !* { global negative_prereq := 't' global prerequisite := $(prerequisite#!) } * { global negative_prereq := '' } } matchstr " $lazily_tested_prereq " { *" $prerequisite "* { } * { matchstr " $lazily_testable_prereq " { *" $prerequisite "* { eval "script=\$test_prereq_lazily_$prerequisite" && if test_run_lazy_prereq_ $prerequisite $script { test_set_prereq $prerequisite } global lazily_tested_prereq := ""$lazily_tested_prereq$prerequisite "" } } } } global total_prereq := $($total_prereq + 1) matchstr $satisfied_prereq { *" $prerequisite "* { global satisfied_this_prereq := 't' } * { global satisfied_this_prereq := '' } } matchstr "$satisfied_this_prereq,$negative_prereq" { t,|,t { global ok_prereq := $($ok_prereq + 1) } * { # Keep a list of missing prerequisites; restore # the negative marker if necessary. global prerequisite := "$(negative_prereq:+!)$prerequisite" if test -z $missing_prereq { global missing_prereq := $prerequisite } else { global missing_prereq := ""$prerequisite,$missing_prereq"" } } } } test $total_prereq = $ok_prereq } proc test_declared_prereq { matchstr ",$test_prereq," { *,$1,* { return 0 } } return 1 } proc test_verify_prereq { test -z $test_prereq || expr >/dev/null $test_prereq : '[A-Z0-9_,!]*$>/dev/null "$test_prereq" : '[A-Z0-9_,!]*$' || error "bug in the test script: '$test_prereq' does not look like a prereq" } proc test_expect_failure { test_start_ test "$Argc" = 3 && do { global test_prereq := $1; shift; } || global test_prereq := '' test "$Argc" = 2 || error "bug in the test script: not 2 or 3 parameters to test-expect-failure" test_verify_prereq export test_prereq if ! test_skip @Argv { say >&3 "checking known breakage: $2> !3 "checking known breakage: $2" if test_run_ $2 expecting_failure { test_known_broken_ok_ $1 } else { test_known_broken_failure_ $1 } } test_finish_ } proc test_expect_success { test_start_ test "$Argc" = 3 && do { global test_prereq := $1; shift; } || global test_prereq := '' test "$Argc" = 2 || error "bug in the test script: not 2 or 3 parameters to test-expect-success" test_verify_prereq export test_prereq if ! test_skip @Argv { say >&3 "expecting success: $2> !3 "expecting success: $2" if test_run_ $2 { test_ok_ $1 } else { test_failure_ @Argv } } test_finish_ } # test_external runs external test scripts that provide continuous # test output about their progress, and succeeds/fails on # zero/non-zero exit code. It outputs the test output on stdout even # in non-verbose mode, and announces the external script with "# run # : ..." before running it. When providing relative paths, keep in # mind that all scripts run in "trash directory". # Usage: test_external description command arguments... # Example: test_external 'Perl API' perl ../path/to/test.pl proc test_external { test "$Argc" = 4 && do { global test_prereq := $1; shift; } || global test_prereq := '' test "$Argc" = 3 || error >&5 "bug in the test script: not 3 or 4 parameters to test_external> !5 "bug in the test script: not 3 or 4 parameters to test_external" global descr := $1 shift test_verify_prereq export test_prereq if ! test_skip $descr @Argv { # Announce the script to reduce confusion about the # test output that follows. say_color "" "# run $test_count: $descr ($ifsjoin(Argv))" # Export TEST_DIRECTORY, TRASH_DIRECTORY and GIT_TEST_LONG # to be able to use them in script export TEST_DIRECTORY TRASH_DIRECTORY GIT_TEST_LONG # Run command; redirect its stderr to &4 as in # test_run_, but keep its stdout on our stdout even in # non-verbose mode. @Argv !2 > !4 if test "$Status" = 0 { if test $test_external_has_tap -eq 0 { test_ok_ $descr } else { say_color "" "# test_external test $descr was ok" global test_success := $($test_success + 1) } } else { if test $test_external_has_tap -eq 0 { test_failure_ $descr @Argv } else { say_color error "# test_external test $descr failed: $ifsjoin(Argv)" global test_failure := $($test_failure + 1) } } } } # Like test_external, but in addition tests that the command generated # no output on stderr. proc test_external_without_stderr { # The temporary file has no (and must have no) security # implications. global tmp := $(TMPDIR:-/tmp) global stderr := ""$tmp/git-external-stderr.$Pid.tmp"" test_external @Argv !4 > $stderr test -f $stderr || error "Internal error: $stderr disappeared." global descr := ""no stderr: $1"" shift say >&3 "# expecting no stderr from previous command> !3 "# expecting no stderr from previous command" if test ! -s $stderr { rm $stderr if test $test_external_has_tap -eq 0 { test_ok_ $descr } else { say_color "" "# test_external_without_stderr test $descr was ok" global test_success := $($test_success + 1) } } else { if test $verbose = t { global output := $[echo; echo "# Stderr is:"; cat $stderr] } else { global output := '' } # rm first in case test_failure exits. rm $stderr if test $test_external_has_tap -eq 0 { test_failure_ $descr @Argv $output } else { say_color error "# test_external_without_stderr test $descr failed: $ifsjoin(Argv): $output" global test_failure := $($test_failure + 1) } } } # debugging-friendly alternatives to "test [-f|-d|-e]" # The commands test the existence or non-existence of $1. $2 can be # given to provide a more precise diagnosis. proc test_path_is_file { if ! test -f $1 { echo "File $1 doesn't exist. $2" false } } proc test_path_is_dir { if ! test -d $1 { echo "Directory $1 doesn't exist. $2" false } } # Check if the directory exists and is empty as expected, barf otherwise. proc test_dir_is_empty { test_path_is_dir $1 && if test -n $[ls -a1 $1 | egrep -v '^\.\.?$] { echo "Directory '$1' is not empty, it contains:" ls -la $1 return 1 } } proc test_path_is_missing { if test -e $1 { echo "Path exists:" ls -ld $1 if test $Argc -ge 1 { echo "$ifsjoin(Argv)" } false } } # test_line_count checks that a file has the number of lines it # ought to. For example: # # test_expect_success 'produce exactly one line of output' ' # do something >output && # test_line_count = 1 output # ' # # is like "test $(wc -l &2 "test_must_fail: command succeeded: $ifsjoin(Argv)> !2 "test_must_fail: command succeeded: $*" return 1 } elif test_match_signal 13 $exit_code && list_contains $_test_ok sigpipe { return 0 } elif test $exit_code -gt 129 && test $exit_code -le 192 { echo >&2 "test_must_fail: died by signal $($exit_code - 128): $ifsjoin(Argv)> !2 "test_must_fail: died by signal $(($exit_code - 128)): $*" return 1 } elif test $exit_code -eq 127 { echo >&2 "test_must_fail: command not found: $ifsjoin(Argv)> !2 "test_must_fail: command not found: $*" return 1 } elif test $exit_code -eq 126 { echo >&2 "test_must_fail: valgrind error: $ifsjoin(Argv)> !2 "test_must_fail: valgrind error: $*" return 1 } return 0 } # Similar to test_must_fail, but tolerates success, too. This is # meant to be used in contexts like: # # test_expect_success 'some command works without configuration' ' # test_might_fail git config --unset all.configuration && # do something # ' # # Writing "git config --unset all.configuration || :" would be wrong, # because we want to notice if it fails due to segv. proc test_might_fail { test_must_fail ok=success @Argv } # Similar to test_must_fail and test_might_fail, but check that a # given command exited with a given exit code. Meant to be used as: # # test_expect_success 'Merge with d/f conflicts' ' # test_expect_code 1 git merge "merge msg" B master # ' proc test_expect_code { global want_code := $1 shift @Argv global exit_code := $Status if test $exit_code = $want_code { return 0 } echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $ifsjoin(Argv)> !2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" return 1 } # test_cmp is a helper function to compare actual and expected output. # You can use it like: # # test_expect_success 'foo works' ' # echo expected >expected && # foo >actual && # test_cmp expected actual # ' # # This could be written as either "cmp" or "diff -u", but: # - cmp's output is not nearly as easy to read as diff -u # - not all diff versions understand "-u" proc test_cmp { $GIT_TEST_CMP @Argv } # test_cmp_bin - helper to compare binary files proc test_cmp_bin { cmp @Argv } # Call any command "$@" but be more verbose about its # failure. This is handy for commands like "test" which do # not output anything when they fail. proc verbose { @Argv && return 0 echo >&2 "command failed: $[git rev-parse --sq-quote @Argv]> !2 "command failed: $(git rev-parse --sq-quote "$@")" return 1 } # Check if the file expected to be empty is indeed empty, and barfs # otherwise. proc test_must_be_empty { if test -s $1 { echo "'$1' is not empty, it contains:" cat $1 return 1 } } # Tests that its two parameters refer to the same revision proc test_cmp_rev { git rev-parse --verify $1 >expect.rev && git rev-parse --verify $2 >actual.rev && test_cmp expect.rev actual.rev } # Print a sequence of integers in increasing order, either with # two arguments (start and end): # # test_seq 1 5 -- outputs 1 2 3 4 5 one line at a time # # or with one argument (end), in which case it starts counting # from 1. proc test_seq { matchstr $Argc { 1 { set 1 @Argv } 2 { } * { error "bug in the test script: not 1 or 2 parameters to test_seq" } } global test_seq_counter__ := $1 while test "$test_seq_counter__" -le "$2" { echo $test_seq_counter__ global test_seq_counter__ := $( $test_seq_counter__ + 1 ) } } # This function can be used to schedule some commands to be run # unconditionally at the end of the test to restore sanity: # # test_expect_success 'test core.capslock' ' # git config core.capslock true && # test_when_finished "git config --unset core.capslock" && # hello world # ' # # That would be roughly equivalent to # # test_expect_success 'test core.capslock' ' # git config core.capslock true && # hello world # git config --unset core.capslock # ' # # except that the greeting and config --unset must both succeed for # the test to pass. # # Note that under --immediate mode, no clean-up is done to help diagnose # what went wrong. proc test_when_finished { # We cannot detect when we are in a subshell in general, but by # doing so on Bash is better than nothing (the test will # silently pass on other shells). test $(BASH_SUBSHELL-0) = 0 || error "bug in test script: test_when_finished does nothing in a subshell" global test_cleanup := ""{ $ifsjoin(Argv) } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup"" } # Most tests can use the created repository, but some may need to create more. # Usage: test_create_repo proc test_create_repo { test "$Argc" = 1 || error "bug in the test script: not 1 parameter to test-create-repo" global repo := $1 mkdir -p $repo shell { cd $repo || error "Cannot setup test environment" "$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" > !3 !2 > !4 || error "cannot run git init -- have you built things yet?" mv .git/hooks .git/hooks-disabled } || exit } # This function helps on symlink challenged file systems when it is not # important that the file system entry is a symbolic link. # Use test_ln_s_add instead of "ln -s x y && git add y" to add a # symbolic link entry y to the index. proc test_ln_s_add { if test_have_prereq SYMLINKS { ln -s $1 $2 && git update-index --add $2 } else { printf '%s' $1 >$2 && global ln_s_obj := $[git hash-object -w $2] && git update-index --add --cacheinfo 120000 $ln_s_obj $2 && # pick up stat info from the file git update-index $2 } } # This function writes out its parameters, one per line proc test_write_lines { printf "%s\n" @Argv } proc perl { command $PERL_PATH @Argv } # Is the value one of the various ways to spell a boolean true/false? proc test_normalize_bool { git -c magic.variable="$1" config --bool magic.variable !2 >/dev/null } # Given a variable $1, normalize the value of it to one of "true", # "false", or "auto" and store the result to it. # # test_tristate GIT_TEST_HTTPD # # A variable set to an empty string is set to 'false'. # A variable set to 'false' or 'auto' keeps its value. # Anything else is set to 'true'. # An unset variable defaults to 'auto'. # # The last rule is to allow people to set the variable to an empty # string and export it to decline testing the particular feature # for versions both before and after this change. We used to treat # both unset and empty variable as a signal for "do not test" and # took any non-empty string as "please test". proc test_tristate { if eval "test x\"\${$1+isset}\" = xisset" { # explicitly set eval " case \"\$$1\" in '') $1=false ;; auto) ;; *) $1=\$(test_normalize_bool \$$1 || echo true) ;; esac " } else { eval "$1=auto" } } # Exit the test suite, either by skipping all remaining tests or by # exiting with an error. If "$1" is "auto", we then we assume we were # opportunistically trying to set up some tests and we skip. If it is # "true", then we report a failure. # # The error/skip message should be given by $2. # proc test_skip_or_die { matchstr $1 { auto { global skip_all := $2 test_done } true { error $2 } * { error "BUG: test tristate is '$1' (real error: $2)" } } } # The following mingw_* functions obey POSIX shell syntax, but are actually # bash scripts, and are meant to be used only with bash on Windows. # A test_cmp function that treats LF and CRLF equal and avoids to fork # diff when possible. proc mingw_test_cmp { # Read text into shell variables and compare them. If the results # are different, use regular diff to report the difference. var test_cmp_a = '', test_cmp_b = '' # When text came from stdin (one argument is '-') we must feed it # to diff. var stdin_for_diff = '' # Since it is difficult to detect the difference between an # empty input file and a failure to read the files, we go straight # to diff if one of the inputs is empty. if test -s $1 && test -s $2 { # regular case: both files non-empty mingw_read_file_strip_cr_ test_cmp_a <$1 mingw_read_file_strip_cr_ test_cmp_b <$2 } elif test -s $1 && test $2 = - { # read 2nd file from stdin mingw_read_file_strip_cr_ test_cmp_a <$1 mingw_read_file_strip_cr_ test_cmp_b stdin_for_diff := ''<<<"$test_cmp_b"'' } elif test $1 = - && test -s $2 { # read 1st file from stdin mingw_read_file_strip_cr_ test_cmp_a mingw_read_file_strip_cr_ test_cmp_b <$2 stdin_for_diff := ''<<<"$test_cmp_a"'' } test -n $test_cmp_a && test -n $test_cmp_b && test $test_cmp_a = $test_cmp_b || eval "diff -u \"\$@\" $stdin_for_diff" } # $1 is the name of the shell variable to fill in proc mingw_read_file_strip_cr_ { # Read line-wise using LF as the line separator # and use IFS to strip CR. var line = '' while : { if env IFS=$'\r' read -r -d $'\n' line { # good line := "$line$'\n"' } else { # we get here at EOF, but also if the last line # was not terminated by LF; in the latter case, # some text was read if test -z $line { # EOF, really break } } eval "$1=\$$1\$line" } } # Like "env FOO=BAR some-program", but run inside a subshell, which means # it also works for shell functions (though those functions cannot impact # the environment outside of the test_env invocation). proc test_env { shell { while test $# -gt 0 { matchstr $1 { *=* { eval "$(1%%=*)=\${1#*=}" eval "export $(1%%=*)" shift } * { @Argv exit } } } } } # Returns true if the numeric exit code in "$2" represents the expected signal # in "$1". Signals should be given numerically. proc test_match_signal { if test $2 = "$(128 + $1)" { # POSIX return 0 } elif test $2 = "$(256 + $1)" { # ksh return 0 } return 1 } # Read up to "$1" bytes (or to EOF) from stdin and write them to stdout. proc test_copy_bytes { perl -e ' my $len = $ARGV[1]; while ($len > 0) { my $s; my $nread = sysread(STDIN, $s, $len); die "cannot read: $!" unless defined($nread); print $s; $len -= $nread; } ' - $1 } (CommandList children: [ (FuncDef name: test_set_editor body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FAKE_EDITOR) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [87] ) ] spids: [87] ) (C {(export)} {(FAKE_EDITOR)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:EDITOR) op: Equal rhs: {(SQ <"\"$FAKE_EDITOR\"">)} spids: [98] ) ] spids: [98] ) (C {(export)} {(EDITOR)}) ] spids: [84] ) spids: [79 83] ) (FuncDef name: test_set_index_version body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_INDEX_VERSION) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [119] ) ] spids: [119] ) (C {(export)} {(GIT_INDEX_VERSION)}) ] spids: [116] ) spids: [111 115] ) (FuncDef name: test_decode_color body: (BraceGroup children: [ (C {(awk)} { (SQ <"\n"> <"\t\tfunction name(n) {\n"> <"\t\t\tif (n == 0) return \"RESET\";\n"> <"\t\t\tif (n == 1) return \"BOLD\";\n"> <"\t\t\tif (n == 30) return \"BLACK\";\n"> <"\t\t\tif (n == 31) return \"RED\";\n"> <"\t\t\tif (n == 32) return \"GREEN\";\n"> <"\t\t\tif (n == 33) return \"YELLOW\";\n"> <"\t\t\tif (n == 34) return \"BLUE\";\n"> <"\t\t\tif (n == 35) return \"MAGENTA\";\n"> <"\t\t\tif (n == 36) return \"CYAN\";\n"> <"\t\t\tif (n == 37) return \"WHITE\";\n"> <"\t\t\tif (n == 40) return \"BLACK\";\n"> <"\t\t\tif (n == 41) return \"BRED\";\n"> <"\t\t\tif (n == 42) return \"BGREEN\";\n"> <"\t\t\tif (n == 43) return \"BYELLOW\";\n"> <"\t\t\tif (n == 44) return \"BBLUE\";\n"> <"\t\t\tif (n == 45) return \"BMAGENTA\";\n"> <"\t\t\tif (n == 46) return \"BCYAN\";\n"> <"\t\t\tif (n == 47) return \"BWHITE\";\n"> <"\t\t}\n"> <"\t\t{\n"> <"\t\t\twhile (match($0, /\\033\\[[0-9;]*m/) != 0) {\n"> <"\t\t\t\tprintf \"%s<\", substr($0, 1, RSTART-1);\n"> <"\t\t\t\tcodes = substr($0, RSTART+2, RLENGTH-3);\n"> <"\t\t\t\tif (length(codes) == 0)\n"> <"\t\t\t\t\tprintf \"%s\", name(0)\n"> <"\t\t\t\telse {\n"> <"\t\t\t\t\tn = split(codes, ary, \";\");\n"> <"\t\t\t\t\tsep = \"\";\n"> <"\t\t\t\t\tfor (i = 1; i <= n; i++) {\n"> <"\t\t\t\t\t\tprintf \"%s%s\", sep, name(ary[i]);\n"> <"\t\t\t\t\t\tsep = \";\"\n"> <"\t\t\t\t\t}\n"> <"\t\t\t\t}\n"> <"\t\t\t\tprintf \">\";\n"> < "\t\t\t\t$0 = substr($0, RSTART + RLENGTH, length($0) - RSTART - RLENGTH + 1);\n" > <"\t\t\t}\n"> <"\t\t\tprint\n"> <"\t\t}\n"> <"\t"> ) } ) ] spids: [137] ) spids: [132 136] ) (FuncDef name: lf_to_nul body: (BraceGroup children:[(C {(perl)} {(-pe)} {(SQ <"y/\\012/\\000/">)})] spids:[194]) spids: [189 193] ) (FuncDef name: nul_to_q body: (BraceGroup children:[(C {(perl)} {(-pe)} {(SQ <"y/\\000/Q/">)})] spids:[213]) spids: [208 212] ) (FuncDef name: q_to_nul body: (BraceGroup children:[(C {(perl)} {(-pe)} {(SQ <"y/Q/\\000/">)})] spids:[232]) spids: [227 231] ) (FuncDef name: q_to_cr body: (BraceGroup children:[(C {(tr)} {(Q)} {(SQ <"\\015">)})] spids:[251]) spids: [246 250] ) (FuncDef name: q_to_tab body: (BraceGroup children:[(C {(tr)} {(Q)} {(SQ <"\\011">)})] spids:[270]) spids: [265 269] ) (FuncDef name: qz_to_tab_space body: (BraceGroup children:[(C {(tr)} {(QZ)} {(SQ <"\\011\\040">)})] spids:[289]) spids: [284 288] ) (FuncDef name: append_cr body: (BraceGroup children: [ (Pipeline children: [(C {(sed)} {(-e)} {(SQ <"s/$/Q/">)}) (C {(tr)} {(Q)} {(SQ <"\\015">)})] negated: False ) ] spids: [308] ) spids: [303 307] ) (FuncDef name: remove_cr body: (BraceGroup children: [ (Pipeline children: [(C {(tr)} {(SQ <"\\015">)} {(Q)}) (C {(sed)} {(-e)} {(SQ <"s/Q$//">)})] negated: False ) ] spids: [337] ) spids: [332 336] ) (FuncDef name: sane_unset body: (BraceGroup children: [ (C {(unset)} {(DQ ($ VSub_At "$@"))}) (ControlFlow token: arg_word:{(0)}) ] spids: [382] ) spids: [377 381] ) (FuncDef name: test_tick body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (C {(test)} {(-z)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(set)}) spids: [414 418] ) ) } ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_tick) op: Equal rhs: {(1112911993)} spids: [425] ) ] spids: [425] ) ] spids: [-1 422] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_tick) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_tick")}) right: (ArithWord w:{(Lit_Digits 60)}) ) spids: [433 440] ) } spids: [432] ) ] spids: [432] ) ] spids: [429 443] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_COMMITTER_DATE) op: Equal rhs: {(DQ ($ VSub_Name "$test_tick") (" -0700"))} spids: [446] ) ] spids: [446] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_AUTHOR_DATE) op: Equal rhs: {(DQ ($ VSub_Name "$test_tick") (" -0700"))} spids: [453] ) ] spids: [453] ) (C {(export)} {(GIT_COMMITTER_DATE)} {(GIT_AUTHOR_DATE)}) ] spids: [404] ) spids: [399 403] ) (FuncDef name: test_pause body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(DQ ($ VSub_Name "$verbose"))} {(Lit_Other "=")} {(t)}) terminator: ) ] action: [ (SimpleCommand words: [{(DQ ($ VSub_Name "$SHELL_PATH"))}] redirects: [ (Redir op_id: Redir_LessAnd fd: -1 arg_word: {(6)} spids: [510] ) (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(3)} spids: [513] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(4)} spids: [516] ) ] ) ] spids: [-1 503] ) ] else_action: [ (SimpleCommand words: [{(error)} {(DQ ("test_pause requires --verbose"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(5)} spids:[525])] ) ] spids: [520 533] ) ] spids: [487] ) spids: [482 486] ) (FuncDef name: debug body: (BraceGroup children: [ (SimpleCommand words: [{(DQ ($ VSub_At "$@"))}] more_env: [(env_pair name:GIT_TEST_GDB val:{(1)} spids:[558])] ) ] spids: [555] ) spids: [550 554] ) (FuncDef name: test_commit body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:notick) op:Equal rhs:{(SQ )} spids:[595])] spids: [595] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:signoff) op: Equal rhs: {(SQ )} spids: [600] ) ] spids: [600] ) (AndOr children: [ (While cond: [ (C {(test)} {($ VSub_Pound "$#")} {(KW_Bang "!") (Lit_Other "=")} {(0)}) ] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(--notick)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:notick) op: Equal rhs: {(yes)} spids: [633] ) ] spids: [633] ) ] spids: [629 630 637 -1] ) (case_arm pat_list: [{(--signoff)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:signoff) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [644] ) ] spids: [644] ) ] spids: [640 641 650 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [(ControlFlow token:)] spids: [653 654 660 -1] ) ] spids: [620 626 663] ) (C {(shift)}) ] spids: [617 669] ) ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(DQ ($ VSub_Number "$1") (.t))} ) spids: [675 682] ) } spids: [674] ) ] spids: [674] ) (AndOr children: [ (SimpleCommand words: [ {(echo)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_Hyphen arg_word: {($ VSub_Number "$1")} ) spids: [690 694] ) ) } ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$file"))} spids: [697] ) ] ) (AndOr children: [ (C {(git)} {(add)} {(DQ ($ VSub_Name "$file"))}) (AndOr children: [ (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$notick"))})] action: [(C {(test_tick)})] spids: [-1 728] ) ] spids: [-1 734] ) (AndOr children: [ (C {(git)} {(commit)} {($ VSub_Name "$signoff")} {(-m)} {(DQ ($ VSub_Number "$1"))} ) (C {(git)} {(tag)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {($ VSub_Number "$1")} ) spids: [759 763] ) ) } ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [592] ) spids: [587 591] ) (FuncDef name: test_merge body: (BraceGroup children: [ (AndOr children: [ (C {(test_tick)}) (AndOr children: [ (C {(git)} {(merge)} {(-m)} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))}) (C {(git)} {(tag)} {(DQ ($ VSub_Number "$1"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [781] ) spids: [776 780] ) (FuncDef name: test_chmod body: (BraceGroup children: [ (AndOr children: [ (C {(chmod)} {(DQ ($ VSub_At "$@"))}) (C {(git)} {(update-index)} {(--add)} {(DQ ("--chmod=") ($ VSub_At "$@"))}) ] op_id: Op_DAmp ) ] spids: [832] ) spids: [827 831] ) (FuncDef name: test_unconfig body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:config_dir) op:Equal rhs:{(SQ )} spids:[869])] spids: [869] ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(-C)})] action: [ (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_dir) op: Equal rhs: {($ VSub_Number "$1")} spids: [891] ) ] spids: [891] ) (C {(shift)}) ] spids: [-1 885] ) ] spids: [-1 898] ) (C {(git)} { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {("-C ") (DQ ($ VSub_Name "$config_dir"))} ) spids: [903 910] ) } {(config)} {(--unset-all)} {(DQ ($ VSub_At "$@"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_status) op: Equal rhs: {($ VSub_QMark "$?")} spids: [921] ) ] spids: [921] ) (Case to_match: {(DQ ($ VSub_Name "$config_status"))} arms: [ (case_arm pat_list: [{(5)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_status) op: Equal rhs: {(0)} spids: [941] ) ] spids: [941] ) ] spids: [934 935 945 -1] ) ] spids: [925 931 948] ) (ControlFlow token: arg_word: {($ VSub_Name "$config_status")} ) ] spids: [866] ) spids: [861 865] ) (FuncDef name: test_config body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:config_dir) op:Equal rhs:{(SQ )} spids:[969])] spids: [969] ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(-C)})] action: [ (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_dir) op: Equal rhs: {($ VSub_Number "$1")} spids: [991] ) ] spids: [991] ) (C {(shift)}) ] spids: [-1 985] ) ] spids: [-1 998] ) (AndOr children: [ (C {(test_when_finished)} { (DQ ("test_unconfig ") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {("-C '") ($ VSub_Name "$config_dir") ("'")} ) spids: [1005 1011] ) (" '") ($ VSub_Number "$1") ("'") ) } ) (C {(git)} { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {("-C ") (DQ ($ VSub_Name "$config_dir"))} ) spids: [1022 1029] ) } {(config)} {(DQ ($ VSub_At "$@"))} ) ] op_id: Op_DAmp ) ] spids: [966] ) spids: [961 965] ) (FuncDef name: test_config_global body: (BraceGroup children: [ (AndOr children: [ (C {(test_when_finished)} {(DQ ("test_unconfig --global '") ($ VSub_Number "$1") ("'"))}) (C {(git)} {(config)} {(--global)} {(DQ ($ VSub_At "$@"))}) ] op_id: Op_DAmp ) ] spids: [1045] ) spids: [1040 1044] ) (FuncDef name: write_script body: (BraceGroup children: [ (AndOr children: [ (BraceGroup children: [ (AndOr children: [ (C {(echo)} { (DQ ("#!") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_Hyphen arg_word: {(DQ ($ VSub_Name "$SHELL_PATH"))} ) spids: [1087 1093] ) ) } ) (C {(cat)}) ] op_id: Op_DAmp ) ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Number "$1"))} spids: [1104] ) ] spids: [1080] ) (C {(chmod)} {(Lit_Other "+") (x)} {(DQ ($ VSub_Number "$1"))}) ] op_id: Op_DAmp ) ] spids: [1077] ) spids: [1072 1076] ) (FuncDef name: test_set_prereq body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:satisfied_prereq) op: Equal rhs: {(DQ ($ VSub_Name "$satisfied_prereq") ($ VSub_Number "$1") (" "))} spids: [1163] ) ] spids: [1163] ) ] spids: [1160] ) spids: [1155 1159] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:satisfied_prereq) op: Equal rhs: {(DQ (" "))} spids: [1172] ) ] spids: [1172] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:lazily_testable_prereq) op: Equal rhs: {(SQ )} spids: [1177] ) (assign_pair lhs: (LhsName name:lazily_tested_prereq) op: Equal rhs: {(SQ )} spids: [1179] ) ] spids: [1177] ) (FuncDef name: test_lazy_prereq body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:lazily_testable_prereq) op: Equal rhs: {(DQ ($ VSub_Name "$lazily_testable_prereq") ($ VSub_Number "$1") (" "))} spids: [1193] ) ] spids: [1193] ) (C {(eval)} {(test_prereq_lazily_) ($ VSub_Number "$1") (Lit_Other "=") (EscapedLiteralPart token:) (2) } ) ] spids: [1190] ) spids: [1185 1189] ) (FuncDef name: test_run_lazy_prereq_ body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:script) op: Equal rhs: { (SQ <"\n"> <"mkdir -p \"$TRASH_DIRECTORY/prereq-test-dir\" &&\n"> <"(\n"> <"\tcd \"$TRASH_DIRECTORY/prereq-test-dir\" &&"> ) (DQ ($ VSub_Number "$2")) (SQ <"\n"> <")">) } spids: [1220] ) ] spids: [1220] ) (SimpleCommand words: [{(say)} {(DQ ("checking prerequisite: ") ($ VSub_Number "$1"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1238])] ) (SimpleCommand words: [{(say)} {(DQ ($ VSub_Name "$script"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1249])] ) (C {(test_eval_)} {(DQ ($ VSub_Name "$script"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:eval_ret) op: Equal rhs: {($ VSub_QMark "$?")} spids: [1264] ) ] spids: [1264] ) (C {(rm)} {(-rf)} {(DQ ($ VSub_Name "$TRASH_DIRECTORY") (/prereq-test-dir))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(DQ ($ VSub_Name "$eval_ret"))} {(Lit_Other "=")} {(0)}) terminator: ) ] action: [ (SimpleCommand words: [{(say)} {(DQ ("prerequisite ") ($ VSub_Number "$1") (" ok"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1296])] ) ] spids: [-1 1291] ) ] else_action: [ (SimpleCommand words: [{(say)} {(DQ ("prerequisite ") ($ VSub_Number "$1") (" not satisfied"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1311])] ) ] spids: [1306 1321] ) (ControlFlow token: arg_word: {($ VSub_Name "$eval_ret")} ) ] spids: [1217] ) spids: [1212 1216] ) (FuncDef name: test_have_prereq body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:save_IFS) op: Equal rhs: {($ VSub_Name "$IFS")} spids: [1343] ) ] spids: [1343] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: {(Lit_Comma ",")} spids: [1347] ) ] spids: [1347] ) (C {(set)} {(--)} {($ VSub_Star "$*")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: {($ VSub_Name "$save_IFS")} spids: [1358] ) ] spids: [1358] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:total_prereq) op:Equal rhs:{(0)} spids:[1363])] spids: [1363] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ok_prereq) op:Equal rhs:{(0)} spids:[1367])] spids: [1367] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:missing_prereq) op: Equal rhs: {(SQ )} spids: [1371] ) ] spids: [1371] ) (ForEach iter_name: prerequisite do_arg_iter: True body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Name "$prerequisite"))} arms: [ (case_arm pat_list: [{(KW_Bang "!") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:negative_prereq) op: Equal rhs: {(t)} spids: [1397] ) ] spids: [1397] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prerequisite) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("!")}) spids: [1402 1406] ) } spids: [1401] ) ] spids: [1401] ) ] spids: [1392 1394 1409 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:negative_prereq) op: Equal rhs: {(SQ )} spids: [1416] ) ] spids: [1416] ) ] spids: [1412 1413 -1 1419] ) ] spids: [1383 1389 1419] ) (Case to_match: {(DQ (" ") ($ VSub_Name "$lazily_tested_prereq") (" "))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (DQ (" ") ($ VSub_Name "$prerequisite") (" ")) (Lit_Other "*") } ] spids: [1434 1441 1444 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Case to_match: {(DQ (" ") ($ VSub_Name "$lazily_testable_prereq") (" "))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (DQ (" ") ($ VSub_Name "$prerequisite") (" ")) (Lit_Other "*") } ] action: [ (AndOr children: [ (C {(eval)} { (DQ ("script=") (EscapedLiteralPart token: ) (test_prereq_lazily_) ($ VSub_Name "$prerequisite") ) } ) (If arms: [ (if_arm cond: [ (C {(test_run_lazy_prereq_)} {(DQ ($ VSub_Name "$prerequisite"))} {(DQ ($ VSub_Name "$script"))} ) ] action: [ (C {(test_set_prereq)} {($ VSub_Name "$prerequisite")}) ] spids: [-1 1497] ) ] spids: [-1 1505] ) ] op_id: Op_DAmp ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:lazily_tested_prereq) op: Equal rhs: { (DQ ($ VSub_Name "$lazily_tested_prereq") ($ VSub_Name "$prerequisite") (" ") ) } spids: [1508] ) ] spids: [1508] ) ] spids: [1462 1469 -1 1516] ) ] spids: [1451 1459 1516] ) ] spids: [1447 1448 1519 -1] ) ] spids: [1423 1431 1522] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:total_prereq) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$total_prereq")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [1527 1534] ) } spids: [1526] ) ] spids: [1526] ) (Case to_match: {(DQ ($ VSub_Name "$satisfied_prereq"))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (DQ (" ") ($ VSub_Name "$prerequisite") (" ")) (Lit_Other "*") } ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:satisfied_this_prereq) op: Equal rhs: {(t)} spids: [1556] ) ] spids: [1556] ) ] spids: [1546 1553 1560 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:satisfied_this_prereq) op: Equal rhs: {(SQ )} spids: [1567] ) ] spids: [1567] ) ] spids: [1563 1564 -1 1570] ) ] spids: [1537 1543 1570] ) (Case to_match: { (DQ ($ VSub_Name "$satisfied_this_prereq") (",") ($ VSub_Name "$negative_prereq") ) } arms: [ (case_arm pat_list: [{(t) (Lit_Comma ",")} {(Lit_Comma ",") (t)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ok_prereq) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$ok_prereq")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [1594 1601] ) } spids: [1593] ) ] spids: [1593] ) ] spids: [1585 1590 1604 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prerequisite) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonPlus arg_word:{("!")}) spids: [1620 1624] ) ($ VSub_Name "$prerequisite") } spids: [1619] ) ] spids: [1619] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$missing_prereq"))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:missing_prereq) op: Equal rhs: {($ VSub_Name "$prerequisite")} spids: [1642] ) ] spids: [1642] ) ] spids: [-1 1639] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:missing_prereq) op: Equal rhs: { (DQ ($ VSub_Name "$prerequisite") (",") ($ VSub_Name "$missing_prereq") ) } spids: [1649] ) ] spids: [1649] ) ] spids: [1646 1657] ) ] spids: [1607 1608 -1 1660] ) ] spids: [1574 1582 1660] ) ] spids: [1380 1663] ) spids: [-1 -1] ) (C {(test)} {($ VSub_Name "$total_prereq")} {(Lit_Other "=")} {($ VSub_Name "$ok_prereq")}) ] spids: [1336] ) spids: [1331 1335] ) (FuncDef name: test_declared_prereq body: (BraceGroup children: [ (Case to_match: {(DQ (",") ($ VSub_Name "$test_prereq") (","))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (Lit_Comma ",") ($ VSub_Number "$1") (Lit_Comma ",") (Lit_Other "*") } ] action: [(ControlFlow token: arg_word:{(0)})] spids: [1697 1702 1710 -1] ) ] spids: [1686 1694 1713] ) (ControlFlow token: arg_word:{(1)}) ] spids: [1683] ) spids: [1678 1682] ) (FuncDef name: test_verify_prereq body: (BraceGroup children: [ (AndOr children: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$test_prereq"))}) (AndOr children: [ (SimpleCommand words: [ {(expr)} {(DQ ($ VSub_Name "$test_prereq"))} {(Lit_Other ":")} {(SQ <"[A-Z0-9_,!]*$">)} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1744])] ) (C {(error)} { (DQ ("bug in the test script: '") ($ VSub_Name "$test_prereq") ("' does not look like a prereq") ) } ) ] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] spids: [1728] ) spids: [1723 1727] ) (FuncDef name: test_expect_failure body: (BraceGroup children: [ (C {(test_start_)}) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(3)}) (AndOr children: [ (BraceGroup children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {($ VSub_Number "$1")} spids: [1796] ) ] spids: [1796] ) terminator: ) (Sentence child: (C {(shift)}) terminator: ) ] spids: [1794] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {(SQ )} spids: [1807] ) ] spids: [1807] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(2)}) (C {(error)} {(DQ ("bug in the test script: not 2 or 3 parameters to test-expect-failure"))} ) ] op_id: Op_DPipe ) (C {(test_verify_prereq)}) (C {(export)} {(test_prereq)}) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_skip)} {(DQ ($ VSub_At "$@"))})] negated:True)] action: [ (SimpleCommand words: [{(say)} {(DQ ("checking known breakage: ") ($ VSub_Number "$2"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1854])] ) (If arms: [ (if_arm cond: [(C {(test_run_)} {(DQ ($ VSub_Number "$2"))} {(expecting_failure)})] action: [(C {(test_known_broken_ok_)} {(DQ ($ VSub_Number "$1"))})] spids: [-1 1874] ) ] else_action: [(C {(test_known_broken_failure_)} {(DQ ($ VSub_Number "$1"))})] spids: [1884 1894] ) ] spids: [-1 1849] ) ] spids: [-1 1897] ) (C {(test_finish_)}) ] spids: [1776] ) spids: [1771 1775] ) (FuncDef name: test_expect_success body: (BraceGroup children: [ (C {(test_start_)}) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(3)}) (AndOr children: [ (BraceGroup children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {($ VSub_Number "$1")} spids: [1930] ) ] spids: [1930] ) terminator: ) (Sentence child: (C {(shift)}) terminator: ) ] spids: [1928] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {(SQ )} spids: [1941] ) ] spids: [1941] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(2)}) (C {(error)} {(DQ ("bug in the test script: not 2 or 3 parameters to test-expect-success"))} ) ] op_id: Op_DPipe ) (C {(test_verify_prereq)}) (C {(export)} {(test_prereq)}) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_skip)} {(DQ ($ VSub_At "$@"))})] negated:True)] action: [ (SimpleCommand words: [{(say)} {(DQ ("expecting success: ") ($ VSub_Number "$2"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[1988])] ) (If arms: [ (if_arm cond: [(C {(test_run_)} {(DQ ($ VSub_Number "$2"))})] action: [(C {(test_ok_)} {(DQ ($ VSub_Number "$1"))})] spids: [-1 2006] ) ] else_action: [(C {(test_failure_)} {(DQ ($ VSub_At "$@"))})] spids: [2016 2026] ) ] spids: [-1 1983] ) ] spids: [-1 2029] ) (C {(test_finish_)}) ] spids: [1910] ) spids: [1905 1909] ) (FuncDef name: test_external body: (BraceGroup children: [ (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(4)}) (AndOr children: [ (BraceGroup children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {($ VSub_Number "$1")} spids: [2083] ) ] spids: [2083] ) terminator: ) (Sentence child: (C {(shift)}) terminator: ) ] spids: [2081] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_prereq) op: Equal rhs: {(SQ )} spids: [2094] ) ] spids: [2094] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(3)}) (SimpleCommand words: [ {(error)} {(DQ ("bug in the test script: not 3 or 4 parameters to test_external"))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(5)} spids:[2112])] ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:descr) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [2120] ) ] spids: [2120] ) (C {(shift)}) (C {(test_verify_prereq)}) (C {(export)} {(test_prereq)}) (If arms: [ (if_arm cond: [ (Pipeline children: [(C {(test_skip)} {(DQ ($ VSub_Name "$descr"))} {(DQ ($ VSub_At "$@"))})] negated: True ) ] action: [ (C {(say_color)} {(DQ )} { (DQ ("# run ") ($ VSub_Name "$test_count") (": ") ($ VSub_Name "$descr") (" (") ($ VSub_Star "$*") (")") ) } ) (C {(export)} {(TEST_DIRECTORY)} {(TRASH_DIRECTORY)} {(GIT_TEST_LONG)}) (SimpleCommand words: [{(DQ ($ VSub_At "$@"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(4)} spids:[2212])] ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_QMark "$?"))} {(Lit_Other "=")} {(0)})] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {($ VSub_Name "$test_external_has_tap")} {(-eq)} {(0)} ) terminator: ) ] action: [(C {(test_ok_)} {(DQ ($ VSub_Name "$descr"))})] spids: [-1 2243] ) ] else_action: [ (C {(say_color)} {(DQ )} {(DQ ("# test_external test ") ($ VSub_Name "$descr") (" was ok"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_success) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_success")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [2269 2276] ) } spids: [2268] ) ] spids: [2268] ) ] spids: [2253 2279] ) ] spids: [-1 2229] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {($ VSub_Name "$test_external_has_tap")} {(-eq)} {(0)}) terminator: ) ] action: [ (C {(test_failure_)} {(DQ ($ VSub_Name "$descr"))} {(DQ ($ VSub_At "$@"))} ) ] spids: [-1 2296] ) ] else_action: [ (C {(say_color)} {(error)} { (DQ ("# test_external test ") ($ VSub_Name "$descr") (" failed: ") ($ VSub_At "$@") ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_failure) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_failure")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [2326 2333] ) } spids: [2325] ) ] spids: [2325] ) ] spids: [2310 2336] ) ] spids: [2282 2339] ) ] spids: [-1 2152] ) ] spids: [-1 2342] ) ] spids: [2066] ) spids: [2061 2065] ) (FuncDef name: test_external_without_stderr body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tmp) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)}) spids: [2370 2375] ) } spids: [2369] ) ] spids: [2369] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stderr) op: Equal rhs: {(DQ ($ VSub_Name "$tmp") (/git-external-stderr.) ($ VSub_Dollar "$$") (.tmp))} spids: [2378] ) ] spids: [2378] ) (SimpleCommand words: [{(test_external)} {(DQ ($ VSub_At "$@"))}] redirects: [ (Redir op_id: Redir_Great fd: 4 arg_word: {(DQ ($ VSub_Name "$stderr"))} spids: [2393] ) ] ) (AndOr children: [ (C {(test)} {(-f)} {(DQ ($ VSub_Name "$stderr"))}) (C {(error)} {(DQ ("Internal error: ") ($ VSub_Name "$stderr") (" disappeared."))}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:descr) op: Equal rhs: {(DQ ("no stderr: ") ($ VSub_Number "$1"))} spids: [2419] ) ] spids: [2419] ) (C {(shift)}) (SimpleCommand words: [{(say)} {(DQ ("# expecting no stderr from previous command"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(3)} spids:[2431])] ) (If arms: [ (if_arm cond: [(C {(test)} {(KW_Bang "!")} {(-s)} {(DQ ($ VSub_Name "$stderr"))})] action: [ (C {(rm)} {(DQ ($ VSub_Name "$stderr"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {($ VSub_Name "$test_external_has_tap")} {(-eq)} {(0)}) terminator: ) ] action: [(C {(test_ok_)} {(DQ ($ VSub_Name "$descr"))})] spids: [-1 2474] ) ] else_action: [ (C {(say_color)} {(DQ )} { (DQ ("# test_external_without_stderr test ") ($ VSub_Name "$descr") (" was ok") ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_success) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_success")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [2500 2507] ) } spids: [2499] ) ] spids: [2499] ) ] spids: [2484 2510] ) ] spids: [-1 2452] ) ] else_action: [ (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Name "$verbose"))} {(Lit_Other "=")} {(t)})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Sentence child: (C {(echo)}) terminator: ) (Sentence child: (C {(echo)} {(DQ ("# Stderr is:"))}) terminator: ) (C {(cat)} {(DQ ($ VSub_Name "$stderr"))}) ] ) left_token: spids: [2533 2549] ) } spids: [2532] ) ] spids: [2532] ) ] spids: [-1 2529] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: {(SQ )} spids: [2555] ) ] spids: [2555] ) ] spids: [2552 2558] ) (C {(rm)} {(DQ ($ VSub_Name "$stderr"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {($ VSub_Name "$test_external_has_tap")} {(-eq)} {(0)}) terminator: ) ] action: [ (C {(test_failure_)} {(DQ ($ VSub_Name "$descr"))} {(DQ ($ VSub_At "$@"))} {(DQ ($ VSub_Name "$output"))} ) ] spids: [-1 2583] ) ] else_action: [ (C {(say_color)} {(error)} { (DQ ("# test_external_without_stderr test ") ($ VSub_Name "$descr") (" failed: ") ($ VSub_At "$@") (": ") ($ VSub_Name "$output") ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_failure) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_failure")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [2619 2626] ) } spids: [2618] ) ] spids: [2618] ) ] spids: [2601 2629] ) ] spids: [2513 2632] ) ] spids: [2358] ) spids: [2353 2357] ) (FuncDef name: test_path_is_file body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Pipeline children: [(C {(test)} {(-f)} {(DQ ($ VSub_Number "$1"))})] negated: True ) ] action: [ (C {(echo)} {(DQ ("File ") ($ VSub_Number "$1") (" doesn't exist. ") ($ VSub_Number "$2"))} ) (C {(false)}) ] spids: [-1 2667] ) ] spids: [-1 2683] ) ] spids: [2651] ) spids: [2646 2650] ) (FuncDef name: test_path_is_dir body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Pipeline children: [(C {(test)} {(-d)} {(DQ ($ VSub_Number "$1"))})] negated: True ) ] action: [ (C {(echo)} { (DQ ("Directory ") ($ VSub_Number "$1") (" doesn't exist. ") ($ VSub_Number "$2") ) } ) (C {(false)}) ] spids: [-1 2709] ) ] spids: [-1 2725] ) ] spids: [2693] ) spids: [2688 2692] ) (FuncDef name: test_dir_is_empty body: (BraceGroup children: [ (AndOr children: [ (C {(test_path_is_dir)} {(DQ ($ VSub_Number "$1"))}) (If arms: [ (if_arm cond: [ (C {(test)} {(-n)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {(-a1)} {(DQ ($ VSub_Number "$1"))}) (C {(egrep)} {(-v)} {(SQ <"^\\.\\.?$">)}) ] negated: False ) ] ) left_token: spids: [2757 2775] ) ) } ) ] action: [ (C {(echo)} { (DQ ("Directory '") ($ VSub_Number "$1") ("' is not empty, it contains:")) } ) (C {(ls)} {(-la)} {(DQ ($ VSub_Number "$1"))}) (ControlFlow token: arg_word: {(1)} ) ] spids: [-1 2779] ) ] spids: [-1 2805] ) ] op_id: Op_DAmp ) ] spids: [2738] ) spids: [2733 2737] ) (FuncDef name: test_path_is_missing body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(C {(test)} {(-e)} {(DQ ($ VSub_Number "$1"))})] action: [ (C {(echo)} {(DQ ("Path exists:"))}) (C {(ls)} {(-ld)} {(DQ ($ VSub_Number "$1"))}) (If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Pound "$#")} {(-ge)} {(1)})] action: [(C {(echo)} {(DQ ($ VSub_Star "$*"))})] spids: [-1 2859] ) ] spids: [-1 2869] ) (C {(false)}) ] spids: [-1 2829] ) ] spids: [-1 2875] ) ] spids: [2815] ) spids: [2810 2814] ) (FuncDef name: test_line_count body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Pound "$#")} {(KW_Bang "!") (Lit_Other "=")} {(3)})] action: [ (C {(error)} {(DQ ("bug in the test script: not 3 parameters to test_line_count"))}) ] spids: [-1 2931] ) (if_arm cond: [ (Pipeline children: [ (C {(test)} { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(wc)} {(-l)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$3"))} spids: [2952] ) ] ) ] ) left_token: spids: [2947 2956] ) } {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))} ) ] negated: True ) ] action: [ (C {(echo)} { (DQ ("test_line_count: line count for ") ($ VSub_Number "$3") (" !") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") ) } ) (C {(cat)} {(DQ ($ VSub_Number "$3"))}) (ControlFlow token: arg_word:{(1)}) ] spids: [2941 2967] ) ] spids: [-1 2994] ) ] spids: [2916] ) spids: [2911 2915] ) (FuncDef name: list_contains body: (BraceGroup children: [ (Case to_match: {(DQ (",") ($ VSub_Number "$1") (","))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (Lit_Comma ",") ($ VSub_Number "$2") (Lit_Comma ",") (Lit_Other "*") } ] action: [(ControlFlow token: arg_word:{(0)})] spids: [3034 3039 3047 -1] ) ] spids: [3023 3031 3050] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3020] ) spids: [3015 3019] ) (FuncDef name: test_must_fail body: (BraceGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(Lit_VarLike "ok=") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_test_ok) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("ok=")}) spids: [3117 3121] ) } spids: [3116] ) ] spids: [3116] ) (C {(shift)}) ] spids: [3111 3113 3127 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_test_ok) op: Equal rhs: {(SQ )} spids: [3134] ) ] spids: [3134] ) ] spids: [3130 3131 3137 -1] ) ] spids: [3102 3108 3140] ) (C {(DQ ($ VSub_At "$@"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:exit_code) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3148] ) ] spids: [3148] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {($ VSub_Name "$exit_code")} {(-eq)} {(0)}) (Pipeline children: [(C {(list_contains)} {(DQ ($ VSub_Name "$_test_ok"))} {(success)})] negated: True ) ] op_id: Op_DAmp ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("test_must_fail: command succeeded: ") ($ VSub_Star "$*"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3180])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [-1 3175] ) (if_arm cond: [ (AndOr children: [ (C {(test_match_signal)} {(13)} {($ VSub_Name "$exit_code")}) (C {(list_contains)} {(DQ ($ VSub_Name "$_test_ok"))} {(sigpipe)}) ] op_id: Op_DAmp ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [3194 3213] ) (if_arm cond: [ (AndOr children: [ (C {(test)} {($ VSub_Name "$exit_code")} {(-gt)} {(129)}) (C {(test)} {($ VSub_Name "$exit_code")} {(-le)} {(192)}) ] op_id: Op_DAmp ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("test_must_fail: died by signal ") (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name "$exit_code")}) right: (ArithWord w:{(Lit_Digits 128)}) ) spids: [3252 3259] ) (": ") ($ VSub_Star "$*") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3247])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3221 3242] ) (if_arm cond: [(C {(test)} {($ VSub_Name "$exit_code")} {(-eq)} {(127)})] action: [ (SimpleCommand words: [{(echo)} {(DQ ("test_must_fail: command not found: ") ($ VSub_Star "$*"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3286])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3270 3281] ) (if_arm cond: [(C {(test)} {($ VSub_Name "$exit_code")} {(-eq)} {(126)})] action: [ (SimpleCommand words: [{(echo)} {(DQ ("test_must_fail: valgrind error: ") ($ VSub_Star "$*"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3316])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3300 3311] ) ] spids: [-1 3330] ) (ControlFlow token: arg_word:{(0)}) ] spids: [3099] ) spids: [3094 3098] ) (FuncDef name: test_might_fail body: (BraceGroup children: [(C {(test_must_fail)} {(Lit_VarLike "ok=") (success)} {(DQ ($ VSub_At "$@"))})] spids: [3376] ) spids: [3371 3375] ) (FuncDef name: test_expect_code body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:want_code) op: Equal rhs: {($ VSub_Number "$1")} spids: [3418] ) ] spids: [3418] ) (C {(shift)}) (C {(DQ ($ VSub_At "$@"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:exit_code) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3430] ) ] spids: [3430] ) (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$exit_code")} {(Lit_Other "=")} {($ VSub_Name "$want_code")} ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [-1 3445] ) ] spids: [-1 3453] ) (SimpleCommand words: [ {(echo)} { (DQ ("test_expect_code: command exited with ") ($ VSub_Name "$exit_code") (", we wanted ") ($ VSub_Name "$want_code") (" ") ($ VSub_Star "$*") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3459])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3415] ) spids: [3410 3414] ) (FuncDef name: test_cmp body: (BraceGroup children: [(C {($ VSub_Name "$GIT_TEST_CMP")} {(DQ ($ VSub_At "$@"))})] spids: [3520] ) spids: [3516 3519] ) (FuncDef name: test_cmp_bin body: (BraceGroup children:[(C {(cmp)} {(DQ ($ VSub_At "$@"))})] spids:[3540]) spids: [3536 3539] ) (FuncDef name: verbose body: (BraceGroup children: [ (AndOr children: [ (C {(DQ ($ VSub_At "$@"))}) (ControlFlow token: arg_word:{(0)}) ] op_id: Op_DAmp ) (SimpleCommand words: [ {(echo)} { (DQ ("command failed: ") (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(--sq-quote)} {(DQ ($ VSub_At "$@"))})] ) left_token: spids: [3587 3597] ) ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3582])] ) (ControlFlow token: arg_word:{(1)}) ] spids: [3566] ) spids: [3561 3565] ) (FuncDef name: test_must_be_empty body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(C {(test)} {(-s)} {(DQ ($ VSub_Number "$1"))})] action: [ (C {(echo)} {(DQ ("'") ($ VSub_Number "$1") ("' is not empty, it contains:"))}) (C {(cat)} {(DQ ($ VSub_Number "$1"))}) (ControlFlow token: arg_word:{(1)}) ] spids: [-1 3634] ) ] spids: [-1 3658] ) ] spids: [3620] ) spids: [3615 3619] ) (FuncDef name: test_cmp_rev body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(rev-parse)} {(--verify)} {(DQ ($ VSub_Number "$1"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect.rev)} spids:[3684])] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(rev-parse)} {(--verify)} {(DQ ($ VSub_Number "$2"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(actual.rev)} spids: [3700] ) ] ) (C {(test_cmp)} {(expect.rev)} {(actual.rev)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [3671] ) spids: [3666 3670] ) (FuncDef name: test_seq body: (BraceGroup children: [ (Case to_match: {($ VSub_Pound "$#")} arms: [ (case_arm pat_list: [{(1)}] action: [(C {(set)} {(1)} {(DQ ($ VSub_At "$@"))})] spids: [3752 3753 3763 -1] ) (case_arm pat_list:[{(2)}] spids:[376637673769-1]) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(error)} {(DQ ("bug in the test script: not 1 or 2 parameters to test_seq"))}) ] spids: [3772 3773 3781 -1] ) ] spids: [3745 3749 3784] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_seq_counter__) op: Equal rhs: {($ VSub_Number "$1")} spids: [3787] ) ] spids: [3787] ) (While cond: [ (C {(test)} {(DQ ($ VSub_Name "$test_seq_counter__"))} {(-le)} {(DQ ($ VSub_Number "$2"))}) ] body: (DoGroup children: [ (C {(echo)} {(DQ ($ VSub_Name "$test_seq_counter__"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_seq_counter__) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$test_seq_counter__")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [3817 3826] ) } spids: [3816] ) ] spids: [3816] ) ] spids: [3806 3829] ) ) ] spids: [3742] ) spids: [3737 3741] ) (FuncDef name: test_when_finished body: (BraceGroup children: [ (AndOr children: [ (C {(test)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(0)}) spids: [3924 3928] ) ) } {(Lit_Other "=")} {(0)} ) (C {(error)} {(DQ ("bug in test script: test_when_finished does nothing in a subshell"))} ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_cleanup) op: Equal rhs: { (DQ ("{ ") ($ VSub_Star "$*") ("\n") ("\t\t} && (exit ") (EscapedLiteralPart token:) (EscapedLiteralPart token:) (eval_ret) (EscapedLiteralPart token:) ("); eval_ret=") (EscapedLiteralPart token:) ("?; ") ($ VSub_Name "$test_cleanup") ) } spids: [3945] ) ] spids: [3945] ) ] spids: [3906] ) spids: [3901 3905] ) (FuncDef name: test_create_repo body: (BraceGroup children: [ (AndOr children: [ (C {(test)} {(DQ ($ VSub_Pound "$#"))} {(Lit_Other "=")} {(1)}) (C {(error)} {(DQ ("bug in the test script: not 1 parameter to test-create-repo"))}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repo) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [3998] ) ] spids: [3998] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$repo"))}) (AndOr children: [ (Subshell child: (CommandList children: [ (AndOr children: [ (C {(cd)} {(DQ ($ VSub_Name "$repo"))}) (C {(error)} {(DQ ("Cannot setup test environment"))}) ] op_id: Op_DPipe ) (AndOr children: [ (SimpleCommand words: [ {(DQ ($ VSub_Name "$GIT_EXEC_PATH") (/git-init))} { (DQ ("--template=") ($ VSub_Name "$GIT_BUILD_DIR") (/templates/blt/)) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(3)} spids: [4042] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(4)} spids: [4045] ) ] ) (C {(error)} {(DQ ("cannot run git init -- have you built things yet?"))}) ] op_id: Op_DPipe ) (C {(mv)} {(.git/hooks)} {(.git/hooks-disabled)}) ] ) spids: [4013 4065] ) (C {(exit)}) ] op_id: Op_DPipe ) ] spids: [3975] ) spids: [3970 3974] ) (FuncDef name: test_ln_s_add body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(C {(test_have_prereq)} {(SYMLINKS)})] action: [ (AndOr children: [ (C {(ln)} {(-s)} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))}) (C {(git)} {(update-index)} {(--add)} {(DQ ($ VSub_Number "$2"))}) ] op_id: Op_DAmp ) ] spids: [-1 4102] ) ] else_action: [ (AndOr children: [ (SimpleCommand words: [{(printf)} {(SQ <"%s">)} {(DQ ($ VSub_Number "$1"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Number "$2"))} spids: [4144] ) ] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ln_s_obj) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(hash-object)} {(-w)} {(DQ ($ VSub_Number "$2"))}) ] ) left_token: spids: [4153 4163] ) } spids: [4152] ) ] spids: [4152] ) (AndOr children: [ (C {(git)} {(update-index)} {(--add)} {(--cacheinfo)} {(120000)} {($ VSub_Name "$ln_s_obj")} {(DQ ($ VSub_Number "$2"))} ) (C {(git)} {(update-index)} {(DQ ($ VSub_Number "$2"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [4131 4200] ) ] spids: [4092] ) spids: [4087 4091] ) (FuncDef name: test_write_lines body: (BraceGroup children: [ (C {(printf)} {(DQ ("%s") (EscapedLiteralPart token:))} {(DQ ($ VSub_At "$@"))} ) ] spids: [4213] ) spids: [4208 4212] ) (FuncDef name: perl body: (BraceGroup children: [(C {(command)} {(DQ ($ VSub_Name "$PERL_PATH"))} {(DQ ($ VSub_At "$@"))})] spids: [4235] ) spids: [4230 4234] ) (FuncDef name: test_normalize_bool body: (BraceGroup children: [ (SimpleCommand words: [ {(git)} {(-c)} {(magic.variable) (Lit_Other "=") (DQ ($ VSub_Number "$1"))} {(config)} {(--bool)} {(magic.variable)} ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[4278])] ) ] spids: [4259] ) spids: [4254 4258] ) (FuncDef name: test_tristate body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (C {(eval)} { (DQ ("test x") (EscapedLiteralPart token:) (EscapedLiteralPart token:) ("{") ($ VSub_Number "$1") ("+isset}") (EscapedLiteralPart token:) (" = xisset") ) } ) ] action: [ (C {(eval)} { (DQ ("\n") ("\t\t\tcase ") (EscapedLiteralPart token:) (EscapedLiteralPart token:) ($ VSub_Number "$1") (EscapedLiteralPart token:) (" in\n") ("\t\t\t'')\t") ($ VSub_Number "$1") ("=false ;;\n") ("\t\t\tauto)\t;;\n") ("\t\t\t*)\t") ($ VSub_Number "$1") ("=") (EscapedLiteralPart token:) ("(test_normalize_bool ") (EscapedLiteralPart token:) ($ VSub_Number "$1") (" || echo true) ;;\n") ("\t\t\tesac\n") ("\t\t") ) } ) ] spids: [-1 4354] ) ] else_action: [(C {(eval)} {(DQ ($ VSub_Number "$1") ("=auto"))})] spids: [4388 4399] ) ] spids: [4335] ) spids: [4330 4334] ) (FuncDef name: test_skip_or_die body: (BraceGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(auto)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {($ VSub_Number "$2")} spids: [4446] ) ] spids: [4446] ) (C {(test_done)}) ] spids: [4442 4443 4453 -1] ) (case_arm pat_list: [{(true)}] action: [(C {(error)} {(DQ ($ VSub_Number "$2"))})] spids: [4456 4457 4467 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(error)} { (DQ ("BUG: test tristate is '") ($ VSub_Number "$1") ("' (real error: ") ($ VSub_Number "$2") (")") ) } ) ] spids: [4470 4471 -1 4485] ) ] spids: [4433 4439 4485] ) ] spids: [4430] ) spids: [4425 4429] ) (FuncDef name: mingw_test_cmp body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:test_cmp_a) op: Equal rhs: {(SQ )} spids: [4521] ) (assign_pair lhs: (LhsName name:test_cmp_b) op: Equal rhs: {(SQ )} spids: [4523] ) ] spids: [4519] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:stdin_for_diff) op: Equal rhs: {(SQ )} spids: [4537] ) ] spids: [4535] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(-s)} {(DQ ($ VSub_Number "$1"))}) (C {(test)} {(-s)} {(DQ ($ VSub_Number "$2"))}) ] op_id: Op_DAmp ) ] action: [ (SimpleCommand words: [{(mingw_read_file_strip_cr_)} {(test_cmp_a)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$1"))} spids: [4585] ) ] ) (SimpleCommand words: [{(mingw_read_file_strip_cr_)} {(test_cmp_b)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$2"))} spids: [4595] ) ] ) ] spids: [-1 4574] ) (if_arm cond: [ (AndOr children: [ (C {(test)} {(-s)} {(DQ ($ VSub_Number "$1"))}) (C {(test)} {(DQ ($ VSub_Number "$2"))} {(Lit_Other "=")} {(-)}) ] op_id: Op_DAmp ) ] action: [ (SimpleCommand words: [{(mingw_read_file_strip_cr_)} {(test_cmp_a)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$1"))} spids: [4635] ) ] ) (C {(mingw_read_file_strip_cr_)} {(test_cmp_b)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stdin_for_diff) op: Equal rhs: {(SQ <"<<<\"$test_cmp_b\"">)} spids: [4646] ) ] spids: [4646] ) ] spids: [4601 4624] ) (if_arm cond: [ (AndOr children: [ (C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(-)}) (C {(test)} {(-s)} {(DQ ($ VSub_Number "$2"))}) ] op_id: Op_DAmp ) ] action: [ (C {(mingw_read_file_strip_cr_)} {(test_cmp_a)}) (SimpleCommand words: [{(mingw_read_file_strip_cr_)} {(test_cmp_b)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$2"))} spids: [4691] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stdin_for_diff) op: Equal rhs: {(SQ <"<<<\"$test_cmp_a\"">)} spids: [4697] ) ] spids: [4697] ) ] spids: [4652 4675] ) ] spids: [-1 4703] ) (AndOr children: [ (C {(test)} {(-n)} {(DQ ($ VSub_Name "$test_cmp_a"))}) (AndOr children: [ (C {(test)} {(-n)} {(DQ ($ VSub_Name "$test_cmp_b"))}) (AndOr children: [ (C {(test)} {(DQ ($ VSub_Name "$test_cmp_a"))} {(Lit_Other "=")} {(DQ ($ VSub_Name "$test_cmp_b"))} ) (C {(eval)} { (DQ ("diff -u ") (EscapedLiteralPart token:) (EscapedLiteralPart token: ) ("@") (EscapedLiteralPart token:) (" ") ($ VSub_Name "$stdin_for_diff") ) } ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [4508] ) spids: [4503 4507] ) (FuncDef name: mingw_read_file_strip_cr_ body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:line) op:Equal spids:[4779])] spids: [4777] ) (While cond: [(C {(Lit_Other ":")})] body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(read)} {(-r)} {(-d)} {(SQ )} {(line)}] more_env: [ (env_pair name: IFS val: {(SQ )} spids: [4792] ) ] ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:line) op: Equal rhs: {($ VSub_Name "$line") (SQ )} spids: [4817] ) ] spids: [4817] ) ] spids: [-1 4810] ) ] else_action: [ (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$line"))})] action: [(ControlFlow token:)] spids: [-1 4850] ) ] spids: [-1 4860] ) ] spids: [4824 4863] ) (C {(eval)} { (DQ ($ VSub_Number "$1") ("=") (EscapedLiteralPart token:) ($ VSub_Number "$1") (EscapedLiteralPart token:) (line) ) } ) ] spids: [4787 4878] ) ) ] spids: [4766] ) spids: [4761 4765] ) (FuncDef name: test_env body: (BraceGroup children: [ (Subshell child: (While cond: [(C {(test)} {($ VSub_Pound "$#")} {(-gt)} {(0)})] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(Lit_Other "*") (Lit_Other "=") (Lit_Other "*")}] action: [ (C {(eval)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{("=*")}) spids: [4935 4939] ) ("=") (EscapedLiteralPart token:) ("{1#*=}") ) } ) (C {(eval)} { (DQ ("export ") (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{("=*")}) spids: [4950 4954] ) ) } ) (C {(shift)}) ] spids: [4926 4929 4961 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [(C {(DQ ($ VSub_At "$@"))}) (C {(exit)})] spids: [4964 4965 4976 -1] ) ] spids: [4917 4923 4979] ) ] spids: [4914 4982] ) ) spids: [4900 4985] ) ] spids: [4897] ) spids: [4892 4896] ) (FuncDef name: test_match_signal body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Number "$2"))} {(Lit_Other "=")} { (DQ (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{(Lit_Digits 128)}) right: (ArithWord w:{($ VSub_Number "$1")}) ) spids: [5015 5022] ) ) } ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [-1 5026] ) (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Number "$2"))} {(Lit_Other "=")} { (DQ (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{(Lit_Digits 256)}) right: (ArithWord w:{($ VSub_Number "$1")}) ) spids: [5049 5056] ) ) } ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [5038 5060] ) ] spids: [-1 5072] ) (ControlFlow token: arg_word:{(1)}) ] spids: [5001] ) spids: [4996 5000] ) (FuncDef name: test_copy_bytes body: (BraceGroup children: [ (C {(perl)} {(-e)} { (SQ <"\n"> <"\t\tmy $len = $ARGV[1];\n"> <"\t\twhile ($len > 0) {\n"> <"\t\t\tmy $s;\n"> <"\t\t\tmy $nread = sysread(STDIN, $s, $len);\n"> <"\t\t\tdie \"cannot read: $!\" unless defined($nread);\n"> <"\t\t\tprint $s;\n"> <"\t\t\t$len -= $nread;\n"> <"\t\t}\n"> <"\t"> ) } {(-)} {(DQ ($ VSub_Number "$1"))} ) ] spids: [5090] ) spids: [5085 5089] ) ] )