summaryrefslogtreecommitdiff
path: root/regression_tests/simulator
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
commit47aa8b00b2b11df13a100489e0f904a4947177ef (patch)
treeb35c9acc778ea2f761f3c549f7bee2f4491b3144 /regression_tests/simulator
parent5b8466f7fae0e071c0f4eda13051c93313910028 (diff)
Import Upstream version 1.4.7
Diffstat (limited to 'regression_tests/simulator')
-rw-r--r--regression_tests/simulator/README12
-rw-r--r--regression_tests/simulator/modify_output_file.out.awk18
-rwxr-xr-xregression_tests/simulator/runtest23
-rw-r--r--regression_tests/simulator/testcases/001_Trivial_test.adf7
-rw-r--r--regression_tests/simulator/testcases/001_Trivial_test.in29
-rw-r--r--regression_tests/simulator/testcases/001_Trivial_test.out.exp66
6 files changed, 155 insertions, 0 deletions
diff --git a/regression_tests/simulator/README b/regression_tests/simulator/README
new file mode 100644
index 0000000..8119035
--- /dev/null
+++ b/regression_tests/simulator/README
@@ -0,0 +1,12 @@
+MCU 8051 IDE simulator engine regression testing
+------------------------------------------------
+
+Each .in file in the testcases directory is used by RTE (Regression Testing
+Environment) to run specific test on the simulator. The .in file is first
+processed by m4 macro-processor and then passed to the simulator command line
+interface. Commands contained in the .in file are processed by the engine and
+generated output is redirected into a file with the same base name as the .in
+file has, but with extension .out . This .out file is located in directory named
+results for comparison with an .exp file located in the same directory as the
+.in file. See MCU 8051 IDE handbook for information about the simulator command
+line interface and its commands, it is a long list.
diff --git a/regression_tests/simulator/modify_output_file.out.awk b/regression_tests/simulator/modify_output_file.out.awk
new file mode 100644
index 0000000..da2629e
--- /dev/null
+++ b/regression_tests/simulator/modify_output_file.out.awk
@@ -0,0 +1,18 @@
+#! /usr/bin/gawk -f
+
+# --------------------------------------------------------------------------
+# Auxiliary script for regression tests environment
+#
+# Modify ouput files from simulator, file extension is `.out'
+# --------------------------------------------------------------------------
+
+# Ignore sim. engine version
+/^MCU8051IDE SIM-ENGINE/ {
+ $0="MCU8051IDE SIM-ENGINE"
+}
+
+
+# Just copy input to output
+{
+ print($0)
+}
diff --git a/regression_tests/simulator/runtest b/regression_tests/simulator/runtest
new file mode 100755
index 0000000..47d2f0b
--- /dev/null
+++ b/regression_tests/simulator/runtest
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+# --------------------------------------------------------------------------
+#
+# MCU 8051 IDE assembler regression testing
+#
+# This script defines what and how is suppose to be tested and runs the tests.
+# See README files for more information.
+#
+# --------------------------------------------------------------------------
+
+
+## Prepare regression testing environment
+source "$(dirname $0)/../rte.lib.sh" # Load regression test environment
+RTE_TEST_NAME="Simulator engine" # Set name of the tested subject
+
+# Set other things ...
+readonly SIMULATOR_COMMAND="tclsh ../../../lib/main.tcl --simulator"
+set -o pipefail
+
+function rte_perform_test() {
+ m4 -D TESTCASE="${1}" "../testcases/${1}.in" | $SIMULATOR_COMMAND &> "${1}.out" || return 1
+}
diff --git a/regression_tests/simulator/testcases/001_Trivial_test.adf b/regression_tests/simulator/testcases/001_Trivial_test.adf
new file mode 100644
index 0000000..9ce3af5
--- /dev/null
+++ b/regression_tests/simulator/testcases/001_Trivial_test.adf
@@ -0,0 +1,7 @@
+# Assembler debug file for MCU 8051 IDE v1.3.10
+# Used assembler: MCU 8051 IDE
+# Date: 10/10/2010
+16EA4033A0B463FBE37FF1204EA24808 "001_Trivial_test.asm"
+0 3 0 116 85
+0 4 2 244
+0 5 3 128 251 \ No newline at end of file
diff --git a/regression_tests/simulator/testcases/001_Trivial_test.in b/regression_tests/simulator/testcases/001_Trivial_test.in
new file mode 100644
index 0000000..70e69db
--- /dev/null
+++ b/regression_tests/simulator/testcases/001_Trivial_test.in
@@ -0,0 +1,29 @@
+echo-on
+set-mcu at89S52
+set-clock 12000
+
+# Load program code
+load-code-adf `../testcases/'TESTCASE()`.adf'
+
+read-sfr-by-name A
+
+step
+read-pc
+read-sfr-by-name A
+
+step
+read-position
+read-pc
+read-sfr 224
+step
+read-pc
+read-sfr 224
+step
+read-pc
+read-sfr 224
+
+step-back
+read-pc
+step-back
+read-pc
+read-pc
diff --git a/regression_tests/simulator/testcases/001_Trivial_test.out.exp b/regression_tests/simulator/testcases/001_Trivial_test.out.exp
new file mode 100644
index 0000000..b2aa5e7
--- /dev/null
+++ b/regression_tests/simulator/testcases/001_Trivial_test.out.exp
@@ -0,0 +1,66 @@
+MCU8051IDE SIM-ENGINE
+READY
+OK
+> set-mcu at89S52
+OK
+> set-clock 12000
+OK
+> load-code-adf ../testcases/001_Trivial_test.adf
+OK
+> read-sfr-by-name A
+0
+OK
+> step
+OK
+> read-pc
+2
+OK
+> read-sfr-by-name A
+85
+OK
+> step
+OK
+> read-position
+F: "./001_Trivial_test.asm"
+L: 5
+V: 0
+B: 0
+OK
+> read-pc
+3
+OK
+> read-sfr 224
+170
+OK
+> step
+OK
+> read-pc
+0
+OK
+> read-sfr 224
+170
+OK
+> step
+OK
+> read-pc
+2
+OK
+> read-sfr 224
+85
+OK
+> step-back
+1
+OK
+> read-pc
+0
+OK
+> step-back
+1
+OK
+> read-pc
+3
+OK
+> read-pc
+3
+OK
+EXITING