From e41853cab0f46749719d2d1a44cd304fce00ff8d Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Fri, 9 Sep 2016 11:09:54 -0700 Subject: [PATCH] Convert the DFG tests to use filecheck. --- tests/cfg/loop.cton | 7 ++++--- tests/cfg/run.sh | 4 +--- tests/cfg/traps_early.cton | 7 ++++--- tests/cfg/unused_node.cton | 8 ++++++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/cfg/loop.cton b/tests/cfg/loop.cton index 73ad1c4b6a..07d93926d8 100644 --- a/tests/cfg/loop.cton +++ b/tests/cfg/loop.cton @@ -1,12 +1,13 @@ ; For testing cfg generation. This code is nonsense. function nonsense(i32, i32) -> f32 { +; check: digraph nonsense { ebb0(v1: i32, v2: i32): v3 = f64const 0x0.0 - brz v2, ebb2 ;;;; ebb0:inst1 -> ebb2 + brz v2, ebb2 ; unordered: ebb0:inst1 -> ebb2 v4 = iconst.i32 0 - jump ebb1(v4) ;;;; ebb0:inst3 -> ebb1 + jump ebb1(v4) ; unordered: ebb0:inst3 -> ebb1 ebb1(v5: i32): v6 = imul_imm v5, 4 @@ -17,7 +18,7 @@ ebb1(v5: i32): v11 = fadd v9, v10 v12 = iadd_imm v5, 1 v13 = icmp ult, v12, v2 - brnz v13, ebb1(v12) ;;;; ebb1:inst12 -> ebb1 + brnz v13, ebb1(v12) ; unordered: ebb1:inst12 -> ebb1 v14 = f64const 0.0 v15 = f64const 0.0 v16 = fdiv v14, v15 diff --git a/tests/cfg/run.sh b/tests/cfg/run.sh index 2230d4c1ca..cd324cc73f 100755 --- a/tests/cfg/run.sh +++ b/tests/cfg/run.sh @@ -16,9 +16,7 @@ fi declare -a fails for testcase in $(find cfg -name '*.cton'); do - annotations=$(cat $testcase | awk /';;;;'/ | awk -F ";;;;" '{print $2}' | sort) - connections=$("${CTONUTIL}" print-cfg "$testcase" | awk /"->"/ | sort) - if diff -u <(echo $annotations) <(echo $connections); then + if "${CTONUTIL}" print-cfg "$testcase" | "${CTONUTIL}" filecheck "$testcase"; then echo OK $testcase else fails=(${fails[@]} "$testcase") diff --git a/tests/cfg/traps_early.cton b/tests/cfg/traps_early.cton index 6993cc128e..71070f4b15 100644 --- a/tests/cfg/traps_early.cton +++ b/tests/cfg/traps_early.cton @@ -2,16 +2,17 @@ ; a terminating instruction before any connections have been made. function nonsense(i32) { +; check: digraph nonsense { ebb0(v1: i32): trap - brnz v1, ebb2 ;;;; ebb0:inst1 -> ebb2 - jump ebb1 ;;;; ebb0:inst2 -> ebb1 + brnz v1, ebb2 ; unordered: ebb0:inst1 -> ebb2 + jump ebb1 ; unordered: ebb0:inst2 -> ebb1 ebb1: v2 = iconst.i32 0 v3 = iadd v1, v3 - jump ebb0(v3) ;;;; ebb1:inst5 -> ebb0 + jump ebb0(v3) ; unordered: ebb1:inst5 -> ebb0 ebb2: return v1 diff --git a/tests/cfg/unused_node.cton b/tests/cfg/unused_node.cton index 3120ffbe68..693196ccde 100644 --- a/tests/cfg/unused_node.cton +++ b/tests/cfg/unused_node.cton @@ -1,15 +1,19 @@ ; For testing cfg generation where some block is never reached. function not_reached(i32) -> i32 { +; check: digraph not_reached { +; check: ebb0 [shape=record, label="{ebb0 | brnz ebb2}"] +; check: ebb1 [shape=record, label="{ebb1 | jump ebb0}"] +; check: ebb2 [shape=record, label="{ebb2}"] ebb0(v0: i32): - brnz v0, ebb2 ;;;; ebb0:inst0 -> ebb2 + brnz v0, ebb2 ; unordered: ebb0:inst0 -> ebb2 trap ebb1: v1 = iconst.i32 1 v2 = iadd v0, v1 - jump ebb0(v2) ;;;; ebb1:inst4 -> ebb0 + jump ebb0(v2) ; unordered: ebb1:inst4 -> ebb0 ebb2: return v0