4403
Couple of improvements for the tangle/ directory: a) Start running tangle unit tests at build time again. b) Option to print out test names as they run, just like in top-level.
This commit is contained in:
parent
d7297b82c5
commit
f898ee7a37
1
build0
1
build0
|
@ -22,6 +22,7 @@ cd tangle
|
|||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
g++ -g -O2 boot.cc -o tangle
|
||||
./tangle test
|
||||
cd ..
|
||||
|
||||
cd termbox
|
||||
|
|
2
build1
2
build1
|
@ -37,9 +37,11 @@ cd tangle
|
|||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' > test_file_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CFLAGS boot.cc -o tangle
|
||||
./tangle test
|
||||
cd ..
|
||||
|
||||
cd termbox
|
||||
|
|
2
build2
2
build2
|
@ -100,9 +100,11 @@ older_than tangle/tangle tangle/*.cc && {
|
|||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' |update test_file_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CFLAGS boot.cc -o tangle
|
||||
./tangle test
|
||||
noisy_cd .. # no effect; just to show us returning to the parent directory
|
||||
}
|
||||
|
||||
|
|
2
build3
2
build3
|
@ -125,9 +125,11 @@ older_than tangle/tangle tangle/*.cc && {
|
|||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' |update test_file_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CFLAGS boot.cc -o tangle
|
||||
./tangle test
|
||||
noisy_cd .. # no effect; just to show us returning to the parent directory
|
||||
}
|
||||
|
||||
|
|
2
build4
2
build4
|
@ -156,9 +156,11 @@ mv_if_exists tangle/tangle $TMP
|
|||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' |update test_file_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CFLAGS boot.cc -o $TMP || quit
|
||||
$TMP test
|
||||
cd ..
|
||||
echo "done building tangle"
|
||||
}
|
||||
|
|
|
@ -86,7 +86,9 @@ older_than ../tangle/tangle ../tangle/*.cc && {
|
|||
ls [0-9]*.cc |grep -v "\.test\.cc$" |sed 's/.*/#include "&"/' |update file_list
|
||||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' |update test_file_list
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
$CXX $CFLAGS boot.cc -o tangle
|
||||
./tangle test
|
||||
noisy_cd ../subx # no effect; just to show us returning to the parent directory
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
typedef void (*test_fn)(void);
|
||||
|
||||
const test_fn Tests[] = {
|
||||
#include "test_list" // auto-generated; see makefile
|
||||
#include "test_list" // auto-generated; see 'build*' scripts
|
||||
};
|
||||
|
||||
// Names for each element of the 'Tests' global, respectively.
|
||||
const string Test_names[] = {
|
||||
#include "test_name_list" // auto-generated; see 'build*' scripts
|
||||
};
|
||||
|
||||
bool Passed = true;
|
||||
|
|
|
@ -22,6 +22,7 @@ string flag_value(const string& flag, int argc, const char* argv[]) {
|
|||
|
||||
int run_tests() {
|
||||
for (unsigned long i=0; i < sizeof(Tests)/sizeof(Tests[0]); ++i) {
|
||||
//? cerr << "running " << Test_names[i] << '\n';
|
||||
START_TRACING_UNTIL_END_OF_SCOPE;
|
||||
setup();
|
||||
(*Tests[i])();
|
||||
|
|
Loading…
Reference in New Issue