| [70d4b4f] | 1 | #!/bin/bash | 
|---|
|  | 2 |  | 
|---|
|  | 3 | ############################################################################## | 
|---|
|  | 4 | # | 
|---|
|  | 5 | # Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | 
|---|
|  | 6 | # | 
|---|
|  | 7 | # The contents of this file are covered under the licence agreement in the | 
|---|
|  | 8 | # file "LICENCE" distributed with Cforall. | 
|---|
|  | 9 | # | 
|---|
|  | 10 | # Runs integration tests for cfa-cc. | 
|---|
|  | 11 | # | 
|---|
|  | 12 | # Output of test run will be copied into $logfile (default: tests/log.txt). | 
|---|
|  | 13 | # Build failures for tests will be placed in tests/$test.make.txt, incorrect | 
|---|
|  | 14 | # output in tests/$test.run.txt. | 
|---|
|  | 15 | # | 
|---|
|  | 16 | # Author           : Aaron B. Moss | 
|---|
|  | 17 | # Created On       : Mon Nov 23 14:19:00 2015 | 
|---|
|  | 18 | # Last Modified By : Aaron B. Moss | 
|---|
|  | 19 | # Last Modified On : Mon Nov 23 14:19:00 2015 | 
|---|
|  | 20 | # Update Count     : 1 | 
|---|
|  | 21 | # | 
|---|
|  | 22 | ############################################################################## | 
|---|
|  | 23 |  | 
|---|
|  | 24 | # list of tests to run; | 
|---|
|  | 25 | # Should be a make target for each test that generates an executable in the | 
|---|
|  | 26 | # current directory named the same; should also be an input file | 
|---|
|  | 27 | # tests/$test.in.txt and expected output tests/$test.out.txt | 
|---|
|  | 28 | tests="vector_test" | 
|---|
|  | 29 |  | 
|---|
|  | 30 | # log file for test output; | 
|---|
|  | 31 | # reset at the beginning of each run | 
|---|
|  | 32 | logfile=tests/log.txt | 
|---|
|  | 33 | touch $logfile && rm $logfile | 
|---|
|  | 34 |  | 
|---|
|  | 35 | # clean existing build artifacts before run | 
|---|
|  | 36 | make clean > /dev/null 2>&1 | 
|---|
|  | 37 |  | 
|---|
|  | 38 | for test in $tests; do | 
|---|
|  | 39 | echo -n "    $test" | tee -a $logfile | 
|---|
|  | 40 |  | 
|---|
|  | 41 | # build, skipping to next test on error | 
|---|
|  | 42 | if ! make $test > tests/$test.make.txt 2>&1; then | 
|---|
|  | 43 | echo -e "\tFAILED with build error:" | tee -a $logfile | 
|---|
|  | 44 | cat tests/$test.make.txt | tee -a $logfile | 
|---|
|  | 45 | continue | 
|---|
|  | 46 | fi | 
|---|
|  | 47 | rm tests/$test.make.txt | 
|---|
|  | 48 |  | 
|---|
|  | 49 | # run, testing against expected output | 
|---|
|  | 50 | ./$test < tests/$test.in.txt > tests/$test.run.txt 2>&1 | 
|---|
|  | 51 | if ! diff tests/$test.out.txt tests/$test.run.txt > tests/$test.diff.txt; then | 
|---|
|  | 52 | echo -e "\tFAILED with output mismatch:" | tee -a $logfile | 
|---|
|  | 53 | cat tests/$test.diff.txt | tee -a $logfile | 
|---|
|  | 54 | continue | 
|---|
|  | 55 | fi | 
|---|
|  | 56 | rm tests/$test.run.txt tests/$test.diff.txt ./$test | 
|---|
|  | 57 |  | 
|---|
|  | 58 | echo -e "\tPASSED" | tee -a $logfile | 
|---|
|  | 59 | done | 
|---|