[sve2] Simulator test generator

Generate random instruction sequences that match a requested instruction form,
and print them out in a TEST() format, for use in simulator testing.

Change-Id: I39c9da158981503f96d5518c17b93a2c1366d9b2
diff --git a/SConstruct b/SConstruct
index 6c1f563..895fe1f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -482,7 +482,7 @@
 
 # Common test code.
 test_build_dir = PrepareVariantDir('test', TargetBuildDir(env))
-test_objects = [env.Object(Glob(join(test_build_dir, '*.cc')))]
+test_objects = [env.Object(Glob(join(test_build_dir, '*.cc'), exclude=join(test_build_dir, 'test-donkey.cc')))]
 
 # AArch32 support
 if CanTargetAArch32(env):
@@ -564,6 +564,15 @@
       CPPPATH = env['CPPPATH'] + [config.dir_aarch64_examples] + [config.dir_tests])
   test_objects.append(test_aarch64_examples_obj)
 
+  # The simulator test generator.
+  donkey_objects = []
+  donkey_objects.append(env.Object(
+      [join(test_build_dir, 'test-donkey.cc'), join(test_aarch64_build_dir, 'test-utils-aarch64.cc')],
+      CPPPATH = env['CPPPATH'] + [config.dir_tests],
+      CCFLAGS = [flag for flag in env['CCFLAGS'] if flag != '-O3']))
+  donkey = env.Program(join(test_build_dir, 'test-donkey'), donkey_objects, LIBS=[libvixl])
+  env.Alias('tests', donkey)
+
 test = env.Program(join(test_build_dir, 'test-runner'), test_objects,
                    LIBS=[libvixl])
 env.Alias('tests', test)