X86: Implement IST stack switching.
[gem5.git] / tests / SConscript
index 1228e78d28e58ee753fe7315b4ef965b4d669c8c..016b3a26a3e2603c183fd6b21a1808f496b68b8c 100644 (file)
@@ -58,7 +58,7 @@ def check_test(target, source, env):
         if os.path.exists(t.abspath):
             Execute(Delete(t.abspath))
     # Run diff on output & ref directories to find differences.
-    # Exclude m5stats.txt since we will use diff-out on that.
+    # Exclude the stats file since we will use diff-out on that.
     Execute(env.subst('diff -ubr ${SOURCES[0].dir} ${SOURCES[1].dir} ' +
                       '-I "^command line:" ' +         # for stdout file
                       '-I "^M5 compiled " ' +          # for stderr file
@@ -67,12 +67,12 @@ def check_test(target, source, env):
                       '-I "^Simulation complete at" ' +        # for stderr file
                       '-I "^Listening for" ' +         # for stderr file
                       '-I "listening for remote gdb" ' + # for stderr file
-                      '--exclude=m5stats.txt --exclude=SCCS ' +
+                      '--exclude=stats.txt --exclude=SCCS ' +
                       '--exclude=${TARGETS[0].file} ' +
                       '> ${TARGETS[0]}', target=target, source=source), None)
     print "===== Output differences ====="
     print contents(target[0])
-    # Run diff-out on m5stats.txt file
+    # Run diff-out on stats.txt file
     status = Execute(env.subst('$DIFFOUT $SOURCES > ${TARGETS[1]}',
                                target=target, source=source),
                      strfunction=None)
@@ -102,23 +102,44 @@ def print_test(target, source, env):
 
 printAction = env.Action(print_test, strfunction = None)
 
+# Static vars for update_test:
+# - long-winded message about ignored sources
+ignore_msg = '''
+Note: The following file(s) will not be copied.  New non-standard
+      output files must be copied manually once before update_ref will
+      recognize them as outputs.  Otherwise they are assumed to be
+      inputs and are ignored.
+'''
+# - reference files always needed
+needed_files = set(['simout', 'simerr', 'stats.txt', 'config.ini'])
+# - source files we always want to ignore
+known_ignores = set(['status', 'outdiff', 'statsdiff'])
+
 def update_test(target, source, env):
     """Update reference test outputs.
 
-    Target is phony.  First two sources are the ref & new m5stats.txt
+    Target is phony.  First two sources are the ref & new stats.txt file
     files, respectively.  We actually copy everything in the
     respective directories except the status & diff output files.
 
     """
     dest_dir = str(source[0].get_dir())
     src_dir = str(source[1].get_dir())
-    dest_files = os.listdir(dest_dir)
-    src_files = os.listdir(src_dir)
-    # Exclude status & diff outputs
-    for f in ('outdiff', 'statsdiff', 'status'):
-        if f in src_files:
-            src_files.remove(f)
-    for f in src_files:
+    dest_files = set(os.listdir(dest_dir))
+    src_files = set(os.listdir(src_dir))
+    # Copy all of the required files plus any existing dest files.
+    wanted_files = needed_files | dest_files
+    missing_files = wanted_files - src_files
+    if len(missing_files) > 0:
+        print "  WARNING: the following file(s) are missing " \
+              "and will not be updated:"
+        print "    ", " ,".join(missing_files)
+    copy_files = wanted_files - missing_files
+    warn_ignored_files = (src_files - copy_files) - known_ignores
+    if len(warn_ignored_files) > 0:
+        print ignore_msg,
+        print "       ", ", ".join(warn_ignored_files)
+    for f in copy_files:
         if f in dest_files:
             print "  Replacing file", f
             dest_files.remove(f)
@@ -127,12 +148,6 @@ def update_test(target, source, env):
         copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
         copyAction.strfunction = None
         Execute(copyAction)
-    # warn about any files in dest not overwritten (other than SCCS dir)
-    if 'SCCS' in dest_files:
-        dest_files.remove('SCCS')
-    if dest_files:
-        print "Warning: file(s) in", dest_dir, "not updated:",
-        print ', '.join(dest_files)
     return 0
 
 def update_test_string(target, source, env):
@@ -155,31 +170,24 @@ def test_builder(env, ref_dir):
     def tgt(f):
         return os.path.join(tgt_dir, f)
 
-    ref_stats = os.path.join(ref_dir, 'm5stats.txt')
-    new_stats = tgt('m5stats.txt')
+    ref_stats = os.path.join(ref_dir, 'stats.txt')
+    new_stats = tgt('stats.txt')
     status_file = tgt('status')
 
     # Base command for running test.  We mess around with indirectly
     # referring to files via SOURCES and TARGETS so that scons can
     # mess with paths all it wants to and we still get the right
     # files.
-    base_cmd = '${SOURCES[0]} -d $TARGET.dir ${SOURCES[1]} %s' % tgt_dir
-    # stdout and stderr files
-    cmd_stdout = '${TARGETS[0]}'
-    cmd_stderr = '${TARGETS[1]}'
+    cmd = '${SOURCES[0]} -d $TARGET.dir -re ${SOURCES[1]} %s' % tgt_dir
 
     # Prefix test run with batch job submission command if appropriate.
-    # Output redirection is also different for batch runs.
     # Batch command also supports timeout arg (in seconds, not minutes).
-    timeout = 15 # used to be a param, probably should be again
+    timeout = 15 * 60 # used to be a param, probably should be again
     if env['BATCH']:
-        cmd = [env['BATCH_CMD'], '-t', str(timeout * 60),
-               '-o', cmd_stdout, '-e', cmd_stderr, base_cmd]
-    else:
-        cmd = [base_cmd, '>', cmd_stdout, '2>', cmd_stderr]
-            
-    env.Command([tgt('stdout'), tgt('stderr'), new_stats],
-                [env.M5Binary, 'run.py'], ' '.join(cmd))
+        cmd = '%s -t %d %s' % (env['BATCH_CMD'], timeout, cmd)
+
+    env.Command([tgt('simout'), tgt('simerr'), new_stats],
+                [env.M5Binary, 'run.py'], cmd)
 
     # order of targets is important... see check_test
     env.Command([tgt('outdiff'), tgt('statsdiff'), status_file],
@@ -205,9 +213,16 @@ if env['FULL_SYSTEM']:
             configs += ['tsunami-simple-atomic',
                         'tsunami-simple-timing',
                         'tsunami-simple-atomic-dual',
-                        'tsunami-simple-timing-dual']
+                        'tsunami-simple-timing-dual',
+                        'twosys-tsunami-simple-atomic',
+                        'tsunami-o3', 'tsunami-o3-dual']
+    if env['TARGET_ISA'] == 'sparc':
+        configs += ['t1000-simple-atomic',
+                    't1000-simple-timing']
+
 else:
-    configs += ['simple-atomic', 'simple-timing', 'o3-timing']
+    configs += ['simple-atomic', 'simple-timing', 'o3-timing', 'memtest',
+                'simple-atomic-mp', 'simple-timing-mp']
 
 cwd = os.getcwd()
 os.chdir(str(Dir('.').srcdir))