Browse Source
Move the CFG tests into the filetests directory. Remove the tests directory, there are no more shell-driven tests left.pull/3/head
Jakob Stoklund Olesen
8 years ago
8 changed files with 35 additions and 56 deletions
@ -1,4 +1,5 @@ |
|||||
; For testing cfg generation. This code is nonsense. |
; For testing cfg generation. This code is nonsense. |
||||
|
test print-cfg |
||||
|
|
||||
function nonsense(i32, i32) -> f32 { |
function nonsense(i32, i32) -> f32 { |
||||
; check: digraph nonsense { |
; check: digraph nonsense { |
@ -1,5 +1,6 @@ |
|||||
; For testing cfg generation. This code explores the implications of encountering |
; For testing cfg generation. This code explores the implications of encountering |
||||
; a terminating instruction before any connections have been made. |
; a terminating instruction before any connections have been made. |
||||
|
test print-cfg |
||||
|
|
||||
function nonsense(i32) { |
function nonsense(i32) { |
||||
; check: digraph nonsense { |
; check: digraph nonsense { |
@ -1,4 +1,5 @@ |
|||||
; For testing cfg generation where some block is never reached. |
; For testing cfg generation where some block is never reached. |
||||
|
test print-cfg |
||||
|
|
||||
function not_reached(i32) -> i32 { |
function not_reached(i32) -> i32 { |
||||
; check: digraph not_reached { |
; check: digraph not_reached { |
@ -1,14 +0,0 @@ |
|||||
CFG tests |
|
||||
============ |
|
||||
|
|
||||
This directory contains test cases for the Cretonne cfg printer. |
|
||||
|
|
||||
Each test case consists of a `foo.cton` input file annotated with its expected connections. |
|
||||
Annotations are comments of the form: `ebbx:insty -> ebbz` where ebbx is connected to ebbz via |
|
||||
a branch or jump instruction at line y. Instructions are labeled by line number starting from zero: `inst0` .. `instn`. |
|
||||
|
|
||||
|
|
||||
Each input file is run through the `cton-util print-cfg` command and the |
|
||||
output is compared against the specially formatted comments to ensure that |
|
||||
expected connections exist. This scheme allows for changes to graph style |
|
||||
without the need to update tests. |
|
@ -1,36 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
|
|
||||
# Go to tests directory. |
|
||||
cd $(dirname "$0")/.. |
|
||||
|
|
||||
# The path to cton-util should be in $CTONUTIL. |
|
||||
if [ -z "$CTONUTIL" ]; then |
|
||||
CTONUTIL=../src/tools/target/debug/cton-util |
|
||||
fi |
|
||||
|
|
||||
if [ ! -x "$CTONUTIL" ]; then |
|
||||
echo "Can't fund executable cton-util: $CTONUTIL" 1>&2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
declare -a fails |
|
||||
|
|
||||
for testcase in $(find cfg -name '*.cton'); do |
|
||||
if "${CTONUTIL}" print-cfg "$testcase" | "${CTONUTIL}" filecheck "$testcase"; then |
|
||||
echo OK $testcase |
|
||||
else |
|
||||
fails=(${fails[@]} "$testcase") |
|
||||
echo FAIL $testcase |
|
||||
fi |
|
||||
done |
|
||||
|
|
||||
if [ ${#fails[@]} -ne 0 ]; then |
|
||||
echo |
|
||||
echo Failures: |
|
||||
for f in "${fails[@]}"; do |
|
||||
echo " $f" |
|
||||
done |
|
||||
exit 1 |
|
||||
else |
|
||||
echo "All passed" |
|
||||
fi |
|
Loading…
Reference in new issue