1 #!/bin/bash
     
2 
     3 # Die upon any errors
     
4 set -e
     
5 
     6 if [[ ! -f nasmjf ]]
     
7 then
     
8     echo "I need to be run from the nasmjf directory."
     
9     exit 1
    
10 fi
    
11 
    12 for testfile in jonesforth/test_*.f
    
13 do
    
14 #    testname=${testfile%%.f}
    
15     echo "Testing: $testfile"
    
16 
    17     # Pipe the following into nasmjf:
    
18     #   1. Some Forth to print a message
    
19     #   2. The test forth file (defines the word TEST)
    
20     #   3. Some Forth to call the word TEST
    
21     # Then pipe the output to sed which:
    
22     #   1. Skips welcome message lines
    
23     #   2. Removes unique "DSP=nnnnnn" from stack trace test.
    
24     cat <(echo 'CR ." BEEP BOOP. Test mode activated." CR ') \
    
25         $testfile <(echo ' TEST') \
    
26         | ./nasmjf  2>&1 | \
    
27         sed '1,4d;s/DSP=[0-9]*//g' > $testfile.myout
    
28     # See if we match the expected output:
    
29     diff -u $testfile.myout $testfile.out
    
30 done