From 81a7e6d874ecdf402dd7653dce619771b373b279 Mon Sep 17 00:00:00 2001
From: bdr7fv <bdr7fv@git.zephyr-software.com>
Date: Tue, 19 Jun 2012 02:50:43 +0000
Subject: [PATCH] Added a gcc_test for spec.

Former-commit-id: ee27ed941aec6ccf7d942bea06ef1b44c2721101
---
 .gitattributes         |   1 +
 tests/spec/gcc_test.sh | 102 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)
 create mode 100755 tests/spec/gcc_test.sh

diff --git a/.gitattributes b/.gitattributes
index df876d1aa..f75ec3eaf 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -536,6 +536,7 @@ tests/spec/gcc_exp/expr2.s -text
 tests/spec/gcc_exp/g23.s -text
 tests/spec/gcc_exp/s04.s -text
 tests/spec/gcc_exp/scilab.s -text
+tests/spec/gcc_test.sh -text
 tests/spec/gobmk -text
 tests/spec/h264ref -text
 tests/spec/h264ref_exp/act.err -text
diff --git a/tests/spec/gcc_test.sh b/tests/spec/gcc_test.sh
new file mode 100755
index 000000000..9de5d7246
--- /dev/null
+++ b/tests/spec/gcc_test.sh
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+INPUT_DIR=$SPEC_HOME/benchspec/CPU2006/403.gcc/data/ref/input
+BENCH_DIR=$SECURITY_TRANSFORMS_HOME/tests/spec/gcc_exp
+
+cleanup()
+{
+    rm -rf act.out act.err empty
+}
+
+validate()
+{
+    status=$1
+    orig_out=$2
+    rm -f empty
+    touch empty
+
+    if [ $status -ne 0 ]; then
+	echo "TEST WRAPPER FAILURE: Exit Status Non-Zero: $status"
+	cleanup
+	exit 1
+    fi
+
+    diff empty act.err
+
+    if [ $? -ne 0 ];then
+	echo "TEST WRAPPER FAILURE: Error Output Differs from Expected"
+	cleanup
+	exit 1
+    fi
+
+    diff act.out $orig_out
+    if [ $? -ne 0 ];then
+	echo "TEST WRAPPER FAILURE: Actual Output Differs from Expected"
+	cleanup
+	exit 1
+    fi
+    
+}
+
+cleanup
+echo "$1 $INPUT_DIR/166.i -o act.out 2>act.err"
+$1 $INPUT_DIR/166.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/166.s
+
+cleanup
+echo "$1 $INPUT_DIR/scilab.i -o act.out 2>act.err"
+$1 $INPUT_DIR/scilab.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/scilab.s
+
+cleanup
+echo "$1 $INPUT_DIR/200.i -o act.out 2>act.err"
+$1 $INPUT_DIR/200.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/200.s
+
+cleanup
+echo "$1 $INPUT_DIR/c-typeck.i -o act.out 2>act.err"
+$1 $INPUT_DIR/c-typeck.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/c-typeck.s
+
+cleanup
+echo "$1 $INPUT_DIR/cp-decl.i -o act.out 2>act.err"
+$1 $INPUT_DIR/cp-decl.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/cp-decl.s
+
+cleanup
+echo "$1 $INPUT_DIR/expr.i -o act.out 2>act.err"
+$1 $INPUT_DIR/expr.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/expr.s
+
+cleanup
+echo "$1 $INPUT_DIR/expr2.i -o act.out 2>act.err"
+$1 $INPUT_DIR/expr2.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/expr2.s
+
+cleanup
+echo "$1 $INPUT_DIR/g23.i -o act.out 2>act.err"
+$1 $INPUT_DIR/g23.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/g23.s
+
+cleanup
+echo "$1 $INPUT_DIR/s04.i -o act.out 2>act.err"
+$1 $INPUT_DIR/s04.i -o act.out 2>act.err
+status=$?
+validate $status $BENCH_DIR/s04.s
+
+cleanup
+
+echo "TEST WRAPPER SUCCESS"
+exit 0
+
+
+
+
-- 
GitLab