#!/bin/bash global black := ''\E[30m'' global red := ''\E[31m'' global green := ''\E[32m'' global yellow := ''\E[33m'' global blue := ''\E[34m'' global magenta := ''\E[35m'' global cyan := ''\E[36m'' global white := ''\E[37m'' if test -f $2 { global data := $2 if test -f $1.summ { rm $1.summ; } if test -f $1.snap { rm $1.snap; } } else { global data := $1 } if ! ./$1 < $data > /dev/null !2 > .runtest.log { echo -e $red Test $1 failed: $black echo -e $blue cat .runtest.log echo -e $black exit 1 } else { if test -f $1.summ { if test $[grep "FATAL ERROR" $1.summ | wc -l] -gt 0 { echo -e $red "Test $1 failed (FATAL ERROR, read the file $1.summ for details)" $black echo -e $blue cat .runtest.log echo -e $black exit 1; } if test $[grep "FAILED THE TESTS OF ERROR-EXITS" $1.summ | wc -l] -gt 0 { echo -e $red "Test $1 failed (FAILED THE TESTS OF ERROR-EXITS, read the file $1.summ for details)" $black echo -e $blue cat .runtest.log echo -e $black exit 1; } } echo -e $green Test $1 passed$black } (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:black) op:Equal rhs:{(SQ <"\\E[30m">)} spids:[4])] spids: [4] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:red) op:Equal rhs:{(SQ <"\\E[31m">)} spids:[9])] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:green) op:Equal rhs:{(SQ <"\\E[32m">)} spids:[14])] spids: [14] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:yellow) op:Equal rhs:{(SQ <"\\E[33m">)} spids:[19])] spids: [19] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:blue) op:Equal rhs:{(SQ <"\\E[34m">)} spids:[24])] spids: [24] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:magenta) op:Equal rhs:{(SQ <"\\E[35m">)} spids:[29])] spids: [29] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cyan) op:Equal rhs:{(SQ <"\\E[36m">)} spids:[34])] spids: [34] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:white) op:Equal rhs:{(SQ <"\\E[37m">)} spids:[39])] spids: [39] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {($ VSub_Number "$2")} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:data) op: Equal rhs: {($ VSub_Number "$2")} spids: [59] ) ] spids: [59] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {($ VSub_Number "$1") (.summ)} {(Lit_Other "]")}) terminator: ) ] action: [ (Sentence child: (C {(rm)} {($ VSub_Number "$1") (.summ)}) terminator: ) ] spids: [-1 75] ) ] spids: [-1 83] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {($ VSub_Number "$1") (.snap)} {(Lit_Other "]")}) terminator: ) ] action: [ (Sentence child: (C {(rm)} {($ VSub_Number "$1") (.snap)}) terminator: ) ] spids: [-1 98] ) ] spids: [-1 106] ) ] spids: [-1 56] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:data) op: Equal rhs: {($ VSub_Number "$1")} spids: [111] ) ] spids: [111] ) ] spids: [108 114] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(./) ($ VSub_Number "$1")}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$data")} spids: [124] ) (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [128] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(.runtest.log)} spids: [132] ) ] ) ] negated: True ) terminator: ) ] action: [ (C {(echo)} {(-e)} {($ VSub_Name "$red")} {(Test)} {($ VSub_Number "$1")} {(failed) (Lit_Other ":")} {($ VSub_Name "$black")} ) (C {(echo)} {(-e)} {($ VSub_Name "$blue")}) (C {(cat)} {(.runtest.log)}) (C {(echo)} {(-e)} {($ VSub_Name "$black")}) (C {(exit)} {(1)}) ] spids: [-1 138] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {($ VSub_Number "$1") (.summ)} {(Lit_Other "]")}) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(DQ ("FATAL ERROR"))} {($ VSub_Number "$1") (.summ)} ) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: spids: [202 217] ) } {(-gt)} {(0)} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(-e)} {($ VSub_Name "$red")} { (DQ ("Test ") ($ VSub_Number "$1") (" failed (FATAL ERROR, read the file ") ($ VSub_Number "$1") (".summ for details)") ) } {($ VSub_Name "$black")} ) (C {(echo)} {(-e)} {($ VSub_Name "$blue")}) (C {(cat)} {(.runtest.log)}) (C {(echo)} {(-e)} {($ VSub_Name "$black")}) (Sentence child: (C {(exit)} {(1)}) terminator: ) ] spids: [-1 226] ) ] spids: [-1 271] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(DQ ("FAILED THE TESTS OF ERROR-EXITS"))} {($ VSub_Number "$1") (.summ)} ) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: spids: [279 294] ) } {(-gt)} {(0)} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(-e)} {($ VSub_Name "$red")} { (DQ ("Test ") ($ VSub_Number "$1") (" failed (FAILED THE TESTS OF ERROR-EXITS, read the file ") ($ VSub_Number "$1") (".summ for details)") ) } {($ VSub_Name "$black")} ) (C {(echo)} {(-e)} {($ VSub_Name "$blue")}) (C {(cat)} {(.runtest.log)}) (C {(echo)} {(-e)} {($ VSub_Name "$black")}) (Sentence child: (C {(exit)} {(1)}) terminator: ) ] spids: [-1 303] ) ] spids: [-1 348] ) ] spids: [-1 195] ) ] spids: [-1 352] ) (C {(echo)} {(-e)} {($ VSub_Name "$green")} {(Test)} {($ VSub_Number "$1")} {(passed) ($ VSub_Name "$black")} ) ] spids: [180 368] ) ] )