aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGeorgia Kouveli <georgia.kouveli@arm.com>2016-12-15 15:02:20 +0000
committerGeorgia Kouveli <georgia.kouveli@arm.com>2017-03-15 14:28:41 +0000
commitcf4b3000286d141e369c86e647bdd7dcf06e5dc0 (patch)
tree6b1a993063851b7686483237fd35fa82526f37cb /tools
parent94a02bb2b5f7c85dc5a3852aac8c6692f9c6c446 (diff)
Add functionality for generating negative assembler tests.
Change-Id: I16df77a47ffe39f9e6aef21015c092ede3568937
Diffstat (limited to 'tools')
-rwxr-xr-xtools/generate_simulator_traces.py3
-rwxr-xr-xtools/generate_tests.py17
-rw-r--r--tools/test_generator/generator.py8
3 files changed, 17 insertions, 11 deletions
diff --git a/tools/generate_simulator_traces.py b/tools/generate_simulator_traces.py
index 1af5cbc2..d14fdfbb 100755
--- a/tools/generate_simulator_traces.py
+++ b/tools/generate_simulator_traces.py
@@ -188,7 +188,8 @@ if __name__ == '__main__':
# Find the AArch32 tests.
tests = sorted(filter(
- lambda t: 'AARCH32_SIMULATOR_' in t or 'AARCH32_ASSEMBLER_' in t,
+ lambda t: 'AARCH32_SIMULATOR_' in t or ('AARCH32_ASSEMBLER_' in t
+ and not 'AARCH32_ASSEMBLER_NEGATIVE_' in t),
test_list.split()))
for test in tests:
diff --git a/tools/generate_tests.py b/tools/generate_tests.py
index a6cb2b7a..cfb32572 100755
--- a/tools/generate_tests.py
+++ b/tools/generate_tests.py
@@ -381,13 +381,15 @@ pattern.
The "type" field describes the kind of testing we want to do, these types are
recognized by the generator and, at the moment, can be one of "simulator",
-"assembler" and "macro-assembler". Simulator tests will run each instruction and
-record the changes while assembler tests will only record the code buffer and
-never execute anything. MacroAssembler tests currently only generate code to
-check that the MacroAssembler does not crash; the output itself is not yet
-tested. Because you may want to generate more than one test of the same type, as
-we are doing in the example, we need a way to differentiate them. You may use
-the optional "name" field for this.
+"assembler", "macro-assembler" and "assembler-negative". Simulator tests will
+run each instruction and record the changes while assembler tests will only
+record the code buffer and never execute anything. MacroAssembler tests
+currently only generate code to check that the MacroAssembler does not crash;
+the output itself is not yet tested. Because you may want to generate more than
+one test of the same type, as we are doing in the example, we need a way to
+differentiate them. You may use the optional "name" field for this. Negative
+assembler tests check that the instructions described are not allowed, which
+means that an exception is raised when VIXL is built in negative testing mode.
Finally, we describe how to test the instruction by declaring a list of test
cases with the "test-cases" field.
@@ -671,6 +673,7 @@ template_files = {
'simulator': "test/aarch32/config/template-simulator-aarch32.cc.in",
'assembler': "test/aarch32/config/template-assembler-aarch32.cc.in",
'macro-assembler': "test/aarch32/config/template-macro-assembler-aarch32.cc.in",
+ 'assembler-negative': "test/aarch32/config/template-assembler-negative-aarch32.cc.in",
}
diff --git a/tools/test_generator/generator.py b/tools/test_generator/generator.py
index db432424..37afee75 100644
--- a/tools/test_generator/generator.py
+++ b/tools/test_generator/generator.py
@@ -478,6 +478,8 @@ class Generator(object):
return ",\n".join(map(AssemblerTestCaseDefinition, self.test_cases))
elif self.test_type == "macro-assembler":
return ",\n".join(map(MacroAssemblerTestCaseDefinition, self.test_cases))
+ elif self.test_type == "assembler-negative":
+ return ",\n".join(map(MacroAssemblerTestCaseDefinition, self.test_cases))
else:
raise Exception("Unrecognized test type \"{}\".".format(self.test_type))
@@ -529,7 +531,7 @@ class Generator(object):
# `UseScratchRegisterScope` to dynamically allocate them. We need to
# exclude all register operands from the list of available scratch
# registers.
- # MacroAssembler test also need to ensure that they don't try to run tests
+ # MacroAssembler tests also need to ensure that they don't try to run tests
# with registers that are scratch registers; the MacroAssembler contains
# assertions to protect against such usage.
excluded_registers = [
@@ -686,8 +688,8 @@ class Generator(object):
Write out empty trace files so we can compile the new test cases.
"""
for mnemonic in self.mnemonics:
- # The MacroAssembler tests have no traces.
- if self.test_type == "macro-assembler": continue
+ # The MacroAssembler and negative assembler tests have no traces.
+ if self.test_type in ["macro-assembler", "assembler-negative"]: continue
with open(os.path.join(output_directory, self.GetTraceFileName(mnemonic)),
"w") as f: