From be219fa45ae707e49330085217119bf426eebd68 Mon Sep 17 00:00:00 2001 From: Hugo Leblanc Date: Thu, 15 Aug 2024 16:39:53 -0400 Subject: [PATCH 1/2] Rename RV32 test folder --- License.txt => LICENSE | 27 +++++++++++++++++++ test/{riscv-tests => riscv-tests-32}/add.s | 0 test/{riscv-tests => riscv-tests-32}/addi.s | 0 test/{riscv-tests => riscv-tests-32}/and.s | 0 test/{riscv-tests => riscv-tests-32}/andi.s | 0 test/{riscv-tests => riscv-tests-32}/args.s | 0 test/{riscv-tests => riscv-tests-32}/div.s | 0 test/{riscv-tests => riscv-tests-32}/divu.s | 0 test/{riscv-tests => riscv-tests-32}/fadd.s | 0 test/{riscv-tests => riscv-tests-32}/faddd.s | 0 test/{riscv-tests => riscv-tests-32}/fclass.s | 0 .../{riscv-tests => riscv-tests-32}/fclassd.s | 0 test/{riscv-tests => riscv-tests-32}/fcmp.s | 0 test/{riscv-tests => riscv-tests-32}/fcmpd.s | 0 test/{riscv-tests => riscv-tests-32}/fcvt.s | 0 test/{riscv-tests => riscv-tests-32}/fcvt_w.s | 0 .../{riscv-tests => riscv-tests-32}/fcvt_wd.s | 0 test/{riscv-tests => riscv-tests-32}/fcvtd.s | 0 test/{riscv-tests => riscv-tests-32}/fdiv.s | 0 test/{riscv-tests => riscv-tests-32}/fdivd.s | 0 test/{riscv-tests => riscv-tests-32}/fmadd.s | 0 test/{riscv-tests => riscv-tests-32}/fmaddd.s | 0 test/{riscv-tests => riscv-tests-32}/fmin.s | 0 test/{riscv-tests => riscv-tests-32}/fmind.s | 0 test/{riscv-tests => riscv-tests-32}/ldst.s | 0 test/{riscv-tests => riscv-tests-32}/ldstd.s | 0 test/{riscv-tests => riscv-tests-32}/lui.s | 0 test/{riscv-tests => riscv-tests-32}/move.s | 0 test/{riscv-tests => riscv-tests-32}/mul.s | 0 test/{riscv-tests => riscv-tests-32}/mulh.s | 0 test/{riscv-tests => riscv-tests-32}/mulhsu.s | 0 test/{riscv-tests => riscv-tests-32}/mulhu.s | 0 test/{riscv-tests => riscv-tests-32}/or.s | 0 test/{riscv-tests => riscv-tests-32}/ori.s | 0 .../readme.txt | 0 .../recoding.s | 0 .../recodingd.s | 0 test/{riscv-tests => riscv-tests-32}/rem.s | 0 test/{riscv-tests => riscv-tests-32}/remu.s | 0 test/{riscv-tests => riscv-tests-32}/simple.s | 0 test/{riscv-tests => riscv-tests-32}/sll.s | 0 test/{riscv-tests => riscv-tests-32}/slli.s | 0 test/{riscv-tests => riscv-tests-32}/slt.s | 0 test/{riscv-tests => riscv-tests-32}/slti.s | 0 test/{riscv-tests => riscv-tests-32}/sltiu.s | 0 test/{riscv-tests => riscv-tests-32}/sltu.s | 0 test/{riscv-tests => riscv-tests-32}/sra.s | 0 test/{riscv-tests => riscv-tests-32}/srai.s | 0 test/{riscv-tests => riscv-tests-32}/srl.s | 0 test/{riscv-tests => riscv-tests-32}/srli.s | 0 test/{riscv-tests => riscv-tests-32}/sub.s | 0 .../sysprintint.s | 0 test/{riscv-tests => riscv-tests-32}/xor.s | 0 test/{riscv-tests => riscv-tests-32}/xori.s | 0 test/riscv-tests/LICENSE | 24 ----------------- 55 files changed, 27 insertions(+), 24 deletions(-) rename License.txt => LICENSE (51%) rename test/{riscv-tests => riscv-tests-32}/add.s (100%) rename test/{riscv-tests => riscv-tests-32}/addi.s (100%) rename test/{riscv-tests => riscv-tests-32}/and.s (100%) rename test/{riscv-tests => riscv-tests-32}/andi.s (100%) rename test/{riscv-tests => riscv-tests-32}/args.s (100%) rename test/{riscv-tests => riscv-tests-32}/div.s (100%) rename test/{riscv-tests => riscv-tests-32}/divu.s (100%) rename test/{riscv-tests => riscv-tests-32}/fadd.s (100%) rename test/{riscv-tests => riscv-tests-32}/faddd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fclass.s (100%) rename test/{riscv-tests => riscv-tests-32}/fclassd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcmp.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcmpd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcvt.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcvt_w.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcvt_wd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fcvtd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fdiv.s (100%) rename test/{riscv-tests => riscv-tests-32}/fdivd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fmadd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fmaddd.s (100%) rename test/{riscv-tests => riscv-tests-32}/fmin.s (100%) rename test/{riscv-tests => riscv-tests-32}/fmind.s (100%) rename test/{riscv-tests => riscv-tests-32}/ldst.s (100%) rename test/{riscv-tests => riscv-tests-32}/ldstd.s (100%) rename test/{riscv-tests => riscv-tests-32}/lui.s (100%) rename test/{riscv-tests => riscv-tests-32}/move.s (100%) rename test/{riscv-tests => riscv-tests-32}/mul.s (100%) rename test/{riscv-tests => riscv-tests-32}/mulh.s (100%) rename test/{riscv-tests => riscv-tests-32}/mulhsu.s (100%) rename test/{riscv-tests => riscv-tests-32}/mulhu.s (100%) rename test/{riscv-tests => riscv-tests-32}/or.s (100%) rename test/{riscv-tests => riscv-tests-32}/ori.s (100%) rename test/{riscv-tests => riscv-tests-32}/readme.txt (100%) rename test/{riscv-tests => riscv-tests-32}/recoding.s (100%) rename test/{riscv-tests => riscv-tests-32}/recodingd.s (100%) rename test/{riscv-tests => riscv-tests-32}/rem.s (100%) rename test/{riscv-tests => riscv-tests-32}/remu.s (100%) rename test/{riscv-tests => riscv-tests-32}/simple.s (100%) rename test/{riscv-tests => riscv-tests-32}/sll.s (100%) rename test/{riscv-tests => riscv-tests-32}/slli.s (100%) rename test/{riscv-tests => riscv-tests-32}/slt.s (100%) rename test/{riscv-tests => riscv-tests-32}/slti.s (100%) rename test/{riscv-tests => riscv-tests-32}/sltiu.s (100%) rename test/{riscv-tests => riscv-tests-32}/sltu.s (100%) rename test/{riscv-tests => riscv-tests-32}/sra.s (100%) rename test/{riscv-tests => riscv-tests-32}/srai.s (100%) rename test/{riscv-tests => riscv-tests-32}/srl.s (100%) rename test/{riscv-tests => riscv-tests-32}/srli.s (100%) rename test/{riscv-tests => riscv-tests-32}/sub.s (100%) rename test/{riscv-tests => riscv-tests-32}/sysprintint.s (100%) rename test/{riscv-tests => riscv-tests-32}/xor.s (100%) rename test/{riscv-tests => riscv-tests-32}/xori.s (100%) delete mode 100644 test/riscv-tests/LICENSE diff --git a/License.txt b/LICENSE similarity index 51% rename from License.txt rename to LICENSE index e1df356e..c0db1310 100644 --- a/License.txt +++ b/LICENSE @@ -26,6 +26,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. === +Copyright (c) 2012-2015, The Regents of the University of California (Regents). +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the Regents nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +=== + Copyright (C) 1999 Slava Pestov You may use and modify this package for any purpose. Redistribution is diff --git a/test/riscv-tests/add.s b/test/riscv-tests-32/add.s similarity index 100% rename from test/riscv-tests/add.s rename to test/riscv-tests-32/add.s diff --git a/test/riscv-tests/addi.s b/test/riscv-tests-32/addi.s similarity index 100% rename from test/riscv-tests/addi.s rename to test/riscv-tests-32/addi.s diff --git a/test/riscv-tests/and.s b/test/riscv-tests-32/and.s similarity index 100% rename from test/riscv-tests/and.s rename to test/riscv-tests-32/and.s diff --git a/test/riscv-tests/andi.s b/test/riscv-tests-32/andi.s similarity index 100% rename from test/riscv-tests/andi.s rename to test/riscv-tests-32/andi.s diff --git a/test/riscv-tests/args.s b/test/riscv-tests-32/args.s similarity index 100% rename from test/riscv-tests/args.s rename to test/riscv-tests-32/args.s diff --git a/test/riscv-tests/div.s b/test/riscv-tests-32/div.s similarity index 100% rename from test/riscv-tests/div.s rename to test/riscv-tests-32/div.s diff --git a/test/riscv-tests/divu.s b/test/riscv-tests-32/divu.s similarity index 100% rename from test/riscv-tests/divu.s rename to test/riscv-tests-32/divu.s diff --git a/test/riscv-tests/fadd.s b/test/riscv-tests-32/fadd.s similarity index 100% rename from test/riscv-tests/fadd.s rename to test/riscv-tests-32/fadd.s diff --git a/test/riscv-tests/faddd.s b/test/riscv-tests-32/faddd.s similarity index 100% rename from test/riscv-tests/faddd.s rename to test/riscv-tests-32/faddd.s diff --git a/test/riscv-tests/fclass.s b/test/riscv-tests-32/fclass.s similarity index 100% rename from test/riscv-tests/fclass.s rename to test/riscv-tests-32/fclass.s diff --git a/test/riscv-tests/fclassd.s b/test/riscv-tests-32/fclassd.s similarity index 100% rename from test/riscv-tests/fclassd.s rename to test/riscv-tests-32/fclassd.s diff --git a/test/riscv-tests/fcmp.s b/test/riscv-tests-32/fcmp.s similarity index 100% rename from test/riscv-tests/fcmp.s rename to test/riscv-tests-32/fcmp.s diff --git a/test/riscv-tests/fcmpd.s b/test/riscv-tests-32/fcmpd.s similarity index 100% rename from test/riscv-tests/fcmpd.s rename to test/riscv-tests-32/fcmpd.s diff --git a/test/riscv-tests/fcvt.s b/test/riscv-tests-32/fcvt.s similarity index 100% rename from test/riscv-tests/fcvt.s rename to test/riscv-tests-32/fcvt.s diff --git a/test/riscv-tests/fcvt_w.s b/test/riscv-tests-32/fcvt_w.s similarity index 100% rename from test/riscv-tests/fcvt_w.s rename to test/riscv-tests-32/fcvt_w.s diff --git a/test/riscv-tests/fcvt_wd.s b/test/riscv-tests-32/fcvt_wd.s similarity index 100% rename from test/riscv-tests/fcvt_wd.s rename to test/riscv-tests-32/fcvt_wd.s diff --git a/test/riscv-tests/fcvtd.s b/test/riscv-tests-32/fcvtd.s similarity index 100% rename from test/riscv-tests/fcvtd.s rename to test/riscv-tests-32/fcvtd.s diff --git a/test/riscv-tests/fdiv.s b/test/riscv-tests-32/fdiv.s similarity index 100% rename from test/riscv-tests/fdiv.s rename to test/riscv-tests-32/fdiv.s diff --git a/test/riscv-tests/fdivd.s b/test/riscv-tests-32/fdivd.s similarity index 100% rename from test/riscv-tests/fdivd.s rename to test/riscv-tests-32/fdivd.s diff --git a/test/riscv-tests/fmadd.s b/test/riscv-tests-32/fmadd.s similarity index 100% rename from test/riscv-tests/fmadd.s rename to test/riscv-tests-32/fmadd.s diff --git a/test/riscv-tests/fmaddd.s b/test/riscv-tests-32/fmaddd.s similarity index 100% rename from test/riscv-tests/fmaddd.s rename to test/riscv-tests-32/fmaddd.s diff --git a/test/riscv-tests/fmin.s b/test/riscv-tests-32/fmin.s similarity index 100% rename from test/riscv-tests/fmin.s rename to test/riscv-tests-32/fmin.s diff --git a/test/riscv-tests/fmind.s b/test/riscv-tests-32/fmind.s similarity index 100% rename from test/riscv-tests/fmind.s rename to test/riscv-tests-32/fmind.s diff --git a/test/riscv-tests/ldst.s b/test/riscv-tests-32/ldst.s similarity index 100% rename from test/riscv-tests/ldst.s rename to test/riscv-tests-32/ldst.s diff --git a/test/riscv-tests/ldstd.s b/test/riscv-tests-32/ldstd.s similarity index 100% rename from test/riscv-tests/ldstd.s rename to test/riscv-tests-32/ldstd.s diff --git a/test/riscv-tests/lui.s b/test/riscv-tests-32/lui.s similarity index 100% rename from test/riscv-tests/lui.s rename to test/riscv-tests-32/lui.s diff --git a/test/riscv-tests/move.s b/test/riscv-tests-32/move.s similarity index 100% rename from test/riscv-tests/move.s rename to test/riscv-tests-32/move.s diff --git a/test/riscv-tests/mul.s b/test/riscv-tests-32/mul.s similarity index 100% rename from test/riscv-tests/mul.s rename to test/riscv-tests-32/mul.s diff --git a/test/riscv-tests/mulh.s b/test/riscv-tests-32/mulh.s similarity index 100% rename from test/riscv-tests/mulh.s rename to test/riscv-tests-32/mulh.s diff --git a/test/riscv-tests/mulhsu.s b/test/riscv-tests-32/mulhsu.s similarity index 100% rename from test/riscv-tests/mulhsu.s rename to test/riscv-tests-32/mulhsu.s diff --git a/test/riscv-tests/mulhu.s b/test/riscv-tests-32/mulhu.s similarity index 100% rename from test/riscv-tests/mulhu.s rename to test/riscv-tests-32/mulhu.s diff --git a/test/riscv-tests/or.s b/test/riscv-tests-32/or.s similarity index 100% rename from test/riscv-tests/or.s rename to test/riscv-tests-32/or.s diff --git a/test/riscv-tests/ori.s b/test/riscv-tests-32/ori.s similarity index 100% rename from test/riscv-tests/ori.s rename to test/riscv-tests-32/ori.s diff --git a/test/riscv-tests/readme.txt b/test/riscv-tests-32/readme.txt similarity index 100% rename from test/riscv-tests/readme.txt rename to test/riscv-tests-32/readme.txt diff --git a/test/riscv-tests/recoding.s b/test/riscv-tests-32/recoding.s similarity index 100% rename from test/riscv-tests/recoding.s rename to test/riscv-tests-32/recoding.s diff --git a/test/riscv-tests/recodingd.s b/test/riscv-tests-32/recodingd.s similarity index 100% rename from test/riscv-tests/recodingd.s rename to test/riscv-tests-32/recodingd.s diff --git a/test/riscv-tests/rem.s b/test/riscv-tests-32/rem.s similarity index 100% rename from test/riscv-tests/rem.s rename to test/riscv-tests-32/rem.s diff --git a/test/riscv-tests/remu.s b/test/riscv-tests-32/remu.s similarity index 100% rename from test/riscv-tests/remu.s rename to test/riscv-tests-32/remu.s diff --git a/test/riscv-tests/simple.s b/test/riscv-tests-32/simple.s similarity index 100% rename from test/riscv-tests/simple.s rename to test/riscv-tests-32/simple.s diff --git a/test/riscv-tests/sll.s b/test/riscv-tests-32/sll.s similarity index 100% rename from test/riscv-tests/sll.s rename to test/riscv-tests-32/sll.s diff --git a/test/riscv-tests/slli.s b/test/riscv-tests-32/slli.s similarity index 100% rename from test/riscv-tests/slli.s rename to test/riscv-tests-32/slli.s diff --git a/test/riscv-tests/slt.s b/test/riscv-tests-32/slt.s similarity index 100% rename from test/riscv-tests/slt.s rename to test/riscv-tests-32/slt.s diff --git a/test/riscv-tests/slti.s b/test/riscv-tests-32/slti.s similarity index 100% rename from test/riscv-tests/slti.s rename to test/riscv-tests-32/slti.s diff --git a/test/riscv-tests/sltiu.s b/test/riscv-tests-32/sltiu.s similarity index 100% rename from test/riscv-tests/sltiu.s rename to test/riscv-tests-32/sltiu.s diff --git a/test/riscv-tests/sltu.s b/test/riscv-tests-32/sltu.s similarity index 100% rename from test/riscv-tests/sltu.s rename to test/riscv-tests-32/sltu.s diff --git a/test/riscv-tests/sra.s b/test/riscv-tests-32/sra.s similarity index 100% rename from test/riscv-tests/sra.s rename to test/riscv-tests-32/sra.s diff --git a/test/riscv-tests/srai.s b/test/riscv-tests-32/srai.s similarity index 100% rename from test/riscv-tests/srai.s rename to test/riscv-tests-32/srai.s diff --git a/test/riscv-tests/srl.s b/test/riscv-tests-32/srl.s similarity index 100% rename from test/riscv-tests/srl.s rename to test/riscv-tests-32/srl.s diff --git a/test/riscv-tests/srli.s b/test/riscv-tests-32/srli.s similarity index 100% rename from test/riscv-tests/srli.s rename to test/riscv-tests-32/srli.s diff --git a/test/riscv-tests/sub.s b/test/riscv-tests-32/sub.s similarity index 100% rename from test/riscv-tests/sub.s rename to test/riscv-tests-32/sub.s diff --git a/test/riscv-tests/sysprintint.s b/test/riscv-tests-32/sysprintint.s similarity index 100% rename from test/riscv-tests/sysprintint.s rename to test/riscv-tests-32/sysprintint.s diff --git a/test/riscv-tests/xor.s b/test/riscv-tests-32/xor.s similarity index 100% rename from test/riscv-tests/xor.s rename to test/riscv-tests-32/xor.s diff --git a/test/riscv-tests/xori.s b/test/riscv-tests-32/xori.s similarity index 100% rename from test/riscv-tests/xori.s rename to test/riscv-tests-32/xori.s diff --git a/test/riscv-tests/LICENSE b/test/riscv-tests/LICENSE deleted file mode 100644 index 48fe522a..00000000 --- a/test/riscv-tests/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2012-2015, The Regents of the University of California (Regents). -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of the Regents nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. From 4d196dfe4d770ffe6b720d5e33afc1f1b34a29f6 Mon Sep 17 00:00:00 2001 From: Hugo Leblanc Date: Thu, 15 Aug 2024 16:42:26 -0400 Subject: [PATCH 2/2] Use JUnit5 for programs test --- src/rars/venus/HelpHelpAction.java | 2 +- test/RarsTest.java | 2 +- test/RarsUnitTest.java | 128 +++++++++++++++++++++++++++-- test/riscv-tests-32/readme.txt | 1 - 4 files changed, 125 insertions(+), 8 deletions(-) delete mode 100644 test/riscv-tests-32/readme.txt diff --git a/src/rars/venus/HelpHelpAction.java b/src/rars/venus/HelpHelpAction.java index 5d986eb4..7eeeeace 100644 --- a/src/rars/venus/HelpHelpAction.java +++ b/src/rars/venus/HelpHelpAction.java @@ -125,7 +125,7 @@ private JPanel createCopyrightInfoPanel() { JScrollPane copyrightScrollPane; JEditorPane copyrightDisplay; try { - StringBuilder text = loadFiletoStringBuilder("/License.txt").append(""); + StringBuilder text = loadFiletoStringBuilder("/LICENSE").append(""); copyrightDisplay = new JEditorPane("text/html", "
" + text.toString());
             copyrightDisplay.setEditable(false);
             copyrightDisplay.setCaretPosition(0); // assure top of document displayed
diff --git a/test/RarsTest.java b/test/RarsTest.java
index 888b9a05..db0e3cce 100644
--- a/test/RarsTest.java
+++ b/test/RarsTest.java
@@ -56,7 +56,7 @@ public void checkPrograms() {
         // 32-bit tests
         Program p = setupProgram(false);
         runDirectory("./test", p);
-        runDirectory("./test/riscv-tests", p);
+        runDirectory("./test/riscv-tests-32", p);
 
         // 64-bit tests
         p = setupProgram(true);
diff --git a/test/RarsUnitTest.java b/test/RarsUnitTest.java
index 83b2e14b..3c5e2d03 100644
--- a/test/RarsUnitTest.java
+++ b/test/RarsUnitTest.java
@@ -1,6 +1,129 @@
 import org.junit.jupiter.api.Test;
 
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import rars.AssemblyException;
+import rars.ErrorMessage;
+import rars.SimulationException;
+import rars.api.Program;
+import rars.simulator.ProgramArgumentList;
+import rars.simulator.Simulator;
+
+import java.io.*;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assumptions.*;
+
 public class RarsUnitTest extends RarsTest {
+    @ParameterizedTest
+    @MethodSource({"agnosticTestFiles", "rv32TestFiles"})
+    public void testRunRV32(String path) throws IOException {
+        Program p = setupProgram(false);
+        testFile(path, p);
+    }
+
+    @ParameterizedTest
+    @MethodSource({"agnosticTestFiles", "rv64TestFiles"})
+    public void testRunRV64(String path) throws IOException {
+        Program p = setupProgram(true);
+        testFile(path, p);
+    }
+
+    static Stream agnosticTestFiles() {
+        File[] tests = new File("./test").listFiles();
+        assumeTrue(tests != null && Arrays.stream(tests).anyMatch(t -> t.isFile() && t.getName().endsWith(".s")));
+        return Arrays.stream(tests).filter(t -> t.isFile() && t.getName().endsWith(".s")).map(File::getPath);
+    }
+    static Stream rv32TestFiles() {
+        File[] tests = new File("./test/riscv-tests-32").listFiles();
+        assumeTrue(tests != null && Arrays.stream(tests).anyMatch(t -> t.isFile() && t.getName().endsWith(".s")));
+        return Arrays.stream(tests).filter(t -> t.isFile() && t.getName().endsWith(".s")).map(File::getPath);
+    }
+    static Stream rv64TestFiles() {
+        File[] tests = new File("./test/riscv-tests-64").listFiles();
+        assumeTrue(tests != null && Arrays.stream(tests).anyMatch(t -> t.isFile() && t.getName().endsWith(".s")));
+        return Arrays.stream(tests).filter(t -> t.isFile() && t.getName().endsWith(".s")).map(File::getPath);
+    }
+
+    public void testFile(String path, Program p) throws IOException {
+        int[] errorlines = null;
+        String stdin = "", stdout = "", stderr ="", errorMessage = "", exitReason = "";
+        ArrayList programArgumentList = null;
+        ArrayList fileList = new ArrayList<>();
+        fileList.add(path);
+        int exitCode = 0;
+        p.getOptions().selfModifyingCode = false;
+            BufferedReader br = new BufferedReader(new FileReader(path));
+            String line = br.readLine();
+            while(line != null){
+                if (line.startsWith("#error on lines:")) {
+                    String[] linenumbers = line.replaceFirst("#error on lines:", "").split(",");
+                    errorlines = new int[linenumbers.length];
+                    for(int i = 0; i < linenumbers.length; i++){
+                        errorlines[i] = Integer.parseInt(linenumbers[i].trim());
+                    }
+                } else if (line.startsWith("#lib:")) {
+                    String lib = line.replaceFirst("#lib:", "");
+                    fileList.add(Paths.get(path).getParent().resolve(lib).toString());
+                } else if (line.startsWith("#stdin:")) {
+                    stdin = line.replaceFirst("#stdin:", "").replaceAll("\\\\n","\n");
+                } else if (line.startsWith("#stdout:")) {
+                    stdout = line.replaceFirst("#stdout:", "").replaceAll("\\\\n","\n").trim();
+                } else if (line.startsWith("#stderr:")) {
+                    stderr = line.replaceFirst("#stderr:", "").replaceAll("\\\\n","\n").trim();
+                } else if (line.startsWith("#exit:")) {
+                    exitReason = line.replaceFirst("#exit:", "");
+                    try {
+                        exitCode = Integer.parseInt(exitReason);
+                    } catch (NumberFormatException nfe) {
+                        exitCode = -1;
+                    }
+                } else if (line.startsWith("#args:")) {
+                    String args = line.replaceFirst("#args:", "");
+                    programArgumentList = new ProgramArgumentList(args).getProgramArgumentList();
+                } else if (line.startsWith("#error:")) {
+                    errorMessage = line.replaceFirst("#error:", "");
+                } else if (line.startsWith("#selfmod:")) {
+                    String selfmod = line.replaceFirst("#selfmod:", "");
+                    if (selfmod.equals("true")) {
+                        p.getOptions().selfModifyingCode = true;
+                    }
+                }
+                line = br.readLine();
+            }
+
+        try {
+            p.assemble(fileList, path);
+            assertNull(errorlines,"Expected assembly error, but successfully assembled " + path);
+
+            p.setup(programArgumentList, stdin);
+            Simulator.Reason r = p.simulate();
+            if(r != Simulator.Reason.NORMAL_TERMINATION){
+                assertEquals(r.toString().toLowerCase(),exitReason,"Ended abnormally " + r + " while executing " + path);
+            }else{
+                assertEquals(p.getExitCode(), exitCode, "Final exit code was wrong for " + path);
+                assertEquals(p.getSTDOUT().trim(),stdout, "STDOUT was wrong for " + path);
+                assertEquals(p.getSTDERR().trim(), stderr, "STDERR was wrong for " + path);
+            }
+        } catch (AssemblyException ae){
+            assertNotNull(errorlines, "Failed to assemble " + path);
+            assertEquals(ae.errors().errorCount(), errorlines.length, "Mismatched number of assembly errors in" + path);
+
+            Iterator errors = ae.errors().getErrorMessages().iterator();
+            for(int number : errorlines){
+                ErrorMessage error = errors.next();
+                while(error.isWarning()) error = errors.next();
+                assertEquals(error.getLine(), number, "Expected error on line " + number + ". Found error on line " + error.getLine()+" in " + path);
+            }
+        } catch (SimulationException se){
+            assertEquals(se.error().getMessage(), errorMessage, "Crashed while executing " + path + "; " + se.error().generateReport());
+        }
+    }
     @Override
     @Test
     public void checkBinary() {
@@ -13,9 +136,4 @@ public void checkPseudo() {
         super.checkPseudo();
     }
 
-    @Override
-    @Test
-    public void checkPrograms() {
-        super.checkPrograms();
-    }
 }
diff --git a/test/riscv-tests-32/readme.txt b/test/riscv-tests-32/readme.txt
deleted file mode 100644
index e919b6d1..00000000
--- a/test/riscv-tests-32/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-The tests in this directory were generated and modified from the riscv-tests repository. They cover basic conformance of instructions to the specification.