aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Thomas <m8pple@github.com>2017-03-09 16:55:50 +0000
committerDavid Thomas <m8pple@github.com>2017-03-09 16:55:50 +0000
commitf3c05309d4f72d33560b79524f8639013bc60b4e (patch)
treef7b6a3865686ab30d265c192cf433d3872ab0030
parent7922bd0454bc19cc974de7e2f5cf5ef614569782 (diff)
downloadCompiler-f3c05309d4f72d33560b79524f8639013bc60b4e.tar.gz
Compiler-f3c05309d4f72d33560b79524f8639013bc60b4e.zip
Moved from success is 1 to success is 0 as suggested.
-rw-r--r--3-compiler-test_deliverable.md35
-rw-r--r--run_test_deliverable.sh4
-rw-r--r--test_deliverable/testcases/test_ADD0_driver.c2
-rw-r--r--test_deliverable/testcases/test_ADD1_driver.c2
-rw-r--r--test_deliverable/testcases/test_CALL_driver.c2
-rw-r--r--test_deliverable/testcases/test_LOCAL_driver.c2
-rw-r--r--test_deliverable/testcases/test_RETURN_driver.c2
7 files changed, 37 insertions, 12 deletions
diff --git a/3-compiler-test_deliverable.md b/3-compiler-test_deliverable.md
index 71ce1b2..03a8817 100644
--- a/3-compiler-test_deliverable.md
+++ b/3-compiler-test_deliverable.md
@@ -19,10 +19,23 @@ In order to do regression testing, you need two things:
2 - An automated system for running the test-cases.
A simple version of the latter will be developed in the
-lecture, then committed here. Your job is to develop five
-test cases for five language features. There is no requirement
-that your compiler implements these features, only that
-your test-cases try to test them.
+lecture, then committed here. Your job is to develop ten
+test cases looking for different functionality. There is
+no requirement that your compiler implements these features, only
+that your test-cases try to test them.
+
+The testing process shown in the lecture has been captured
+as an automated script in `run_test_deliverable.sh`. You
+can test your compiler simply by doing:
+````
+run_test_deliverable.sh
+````
+or you can test against a different compiler by doing:
+````
+run_test_deliverable.sh path_to_your_compiler
+````
+Any compiler under test must support the same IO as yours (i.e.
+C comes in over stdin, assembly goes out over stdout).
Test case format
----------------
@@ -52,6 +65,8 @@ The testing process for a test-case is then:
If any of these steps fail, then either the test-case is malformed,
or the compiler under test is not generating correct code.
+There are a number of basic test-cases already included.
+
Required tests
--------------
@@ -91,4 +106,14 @@ Your tests cases should be included in a folder called
test_deliverable/test_cases
-and follow the name convention in the example files.
+and follow the naming convention in the example files.
+
+Notes on additional testing
+---------------------------
+
+- You are not required to use this testbench, as it has pretty
+ limited functionality.
+
+- The only required deliverables are the test-case files. You
+ can modify the script if you wish.
+
diff --git a/run_test_deliverable.sh b/run_test_deliverable.sh
index f77e8b7..35f6629 100644
--- a/run_test_deliverable.sh
+++ b/run_test_deliverable.sh
@@ -37,9 +37,9 @@ for DRIVER in test_deliverable/testcases/*_driver.c ; do
# Run the actual executable
qemu-mips working/${NAME}.elf
- if [[ $? -ne 1 ]]; then
+ if [[ $? -ne 0 ]]; then
>&2 echo "ERROR : Testcase returned $?, but expected 0."
fi
-
+ echo "pass"
done
diff --git a/test_deliverable/testcases/test_ADD0_driver.c b/test_deliverable/testcases/test_ADD0_driver.c
index 383949c..6b941d2 100644
--- a/test_deliverable/testcases/test_ADD0_driver.c
+++ b/test_deliverable/testcases/test_ADD0_driver.c
@@ -3,5 +3,5 @@ int f(int x, int y);
int main()
{
- return 40 == f(30,10);
+ return !( 40 == f(30,10) );
}
diff --git a/test_deliverable/testcases/test_ADD1_driver.c b/test_deliverable/testcases/test_ADD1_driver.c
index c0e447b..ee5a885 100644
--- a/test_deliverable/testcases/test_ADD1_driver.c
+++ b/test_deliverable/testcases/test_ADD1_driver.c
@@ -3,5 +3,5 @@ int f(int x);
int main()
{
- return 40 == f(30);
+ return !( 40 == f(30) );
}
diff --git a/test_deliverable/testcases/test_CALL_driver.c b/test_deliverable/testcases/test_CALL_driver.c
index 8bbc3a8..30595b9 100644
--- a/test_deliverable/testcases/test_CALL_driver.c
+++ b/test_deliverable/testcases/test_CALL_driver.c
@@ -8,5 +8,5 @@ int g()
int main()
{
- return 10==f();
+ return !( 10==f() );
}
diff --git a/test_deliverable/testcases/test_LOCAL_driver.c b/test_deliverable/testcases/test_LOCAL_driver.c
index 277543b..7aacf05 100644
--- a/test_deliverable/testcases/test_LOCAL_driver.c
+++ b/test_deliverable/testcases/test_LOCAL_driver.c
@@ -2,5 +2,5 @@ int ffff();
int main()
{
- return ffff()==10;
+ return !( ffff()==10 );
}
diff --git a/test_deliverable/testcases/test_RETURN_driver.c b/test_deliverable/testcases/test_RETURN_driver.c
index dfc0e19..0cfe875 100644
--- a/test_deliverable/testcases/test_RETURN_driver.c
+++ b/test_deliverable/testcases/test_RETURN_driver.c
@@ -3,5 +3,5 @@ int f();
int main()
{
- return 10==f();
+ return !( 10==f() );
}