1 | #!/usr/bin/env bash |
---|
2 | |
---|
3 | # A utility for manual ... |
---|
4 | # (a) validation: helping you agree that what's in .expect is right |
---|
5 | # (b) failure replay: helping you debug one subcase, without using parent--child processes |
---|
6 | |
---|
7 | # Usage: |
---|
8 | # mkdir ~/uchunk-temp |
---|
9 | # cd ~/uchunk-temp |
---|
10 | # rm * |
---|
11 | # ~/mywork/cfa-cc/tests/io/manipulatorsInput-uchunk.extra.sh |
---|
12 | # ls |
---|
13 | # diff -y all-noend.expect.txt all-noend.cpp-actual.txt | nl |
---|
14 | # ./uchunk-getline-cfa < ~/mywork/cfa-cc/tests/io/.in/manipulatorsInput-uchunk.getline.1.txt |
---|
15 | |
---|
16 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
---|
17 | cfa=${cfa:-cfa} |
---|
18 | CXX=${CXX:-g++} |
---|
19 | |
---|
20 | set -v |
---|
21 | $CXX -x c++ $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DIN_DIR=$SCRIPT_DIR/.in/ -o uchunk-all-cpp |
---|
22 | $cfa $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DIN_DIR=$SCRIPT_DIR/.in/ -o uchunk-all-cfa |
---|
23 | |
---|
24 | $CXX -x c++ $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DSUBCASE_ISOLATION=default -o uchunk-default-cpp |
---|
25 | $cfa $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DSUBCASE_ISOLATION=default -o uchunk-default-cfa |
---|
26 | $CXX -x c++ $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DSUBCASE_ISOLATION=getline -o uchunk-getline-cpp |
---|
27 | $cfa $SCRIPT_DIR/manipulatorsInput-uchunk.cfa -DSUBCASE_ISOLATION=getline -o uchunk-getline-cfa |
---|
28 | |
---|
29 | |
---|
30 | cp $SCRIPT_DIR/.expect/manipulatorsInput-uchunk.txt all.expect.txt |
---|
31 | ./uchunk-all-cpp > all.cpp-actual.txt |
---|
32 | ./uchunk-all-cfa > all.cfa-actual.txt |
---|
33 | |
---|
34 | sed 's/^END.*/END -/g' < all.expect.txt > all-noend.expect.txt |
---|
35 | sed 's/^END.*/END -/g' < all.cpp-actual.txt > all-noend.cpp-actual.txt |
---|
36 | sed 's/^END.*/END -/g' < all.cfa-actual.txt > all-noend.cfa-actual.txt |
---|
37 | |
---|
38 | ls -v $SCRIPT_DIR/.in/manipulatorsInput-uchunk* | xargs -n 1 -I {} bash -c 'echo {}; printf \"; cat {}; echo \"' > all.in.txt |
---|
39 | |
---|
40 | diff -q all-noend.expect.txt all-noend.cpp-actual.txt |
---|
41 | diff -q all.expect.txt all.cfa-actual.txt |
---|
42 | diff -q all.cpp-actual.txt all.cfa-actual.txt # noisy: shows getline's cfa--cpp END semantic difference |
---|
43 | diff -q all-noend.cpp-actual.txt all-noend.cfa-actual.txt |
---|
44 | |
---|
45 | ls |
---|
46 | |
---|
47 | set +v |
---|
48 | |
---|
49 | echo Done. Further useful commands might include: |
---|
50 | echo cat all.in.txt |
---|
51 | echo diff -y all-noend.expect.txt all-noend.cpp-actual.txt '|' nl |
---|
52 | echo diff -y all.expect.txt all.cfa-actual.txt '|' nl |
---|
53 | echo diff -y all.cpp-actual.txt all.cfa-actual.txt '|' nl |
---|
54 | echo diff -y all-noend.cpp-actual.txt all-noend.cfa-actual.txt '|' nl |
---|
55 | echo './uchunk-getline-cfa <' $SCRIPT_DIR/.in/manipulatorsInput-uchunk.getline.1.txt |
---|
56 | echo './uchunk-default-cfa <' $SCRIPT_DIR/.in/manipulatorsInput-uchunk.default.1.txt |
---|