1# Copyright (c) 2012 ARM Limited 2# All rights reserved 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license 9# terms below provided that you ensure that this notice is replicated 10# unmodified and in its entirety in all distributions of the software, 11# modified or unmodified, in source code or in binary form. 12# |
13# Copyright (c) 2006-2007 The Regents of The University of Michigan 14# All rights reserved. 15# 16# Redistribution and use in source and binary forms, with or without 17# modification, are permitted provided that the following conditions are 18# met: redistributions of source code must retain the above copyright 19# notice, this list of conditions and the following disclaimer; 20# redistributions in binary form must reproduce the above copyright --- 21 unchanged lines hidden (view full) --- 42import sys 43import re 44import string 45 46from os.path import join as joinpath 47 48import m5 49 |
50def skip_test(reason=""): 51 """Signal that a test should be skipped and optionally print why. 52 53 Keyword arguments: 54 reason -- Reason why the test failed. Output is omitted if empty. 55 """ 56 57 if reason: 58 print "Skipping test: %s" % reason 59 sys.exit(2) 60 61def has_sim_object(name): 62 """Test if a SimObject exists in the simulator. 63 64 Arguments: 65 name -- Name of SimObject (string) 66 67 Returns: True if the object exists, False otherwise. 68 """ 69 70 try: 71 cls = getattr(m5.objects, name) 72 return issubclass(cls, m5.objects.SimObject) 73 except AttributeError: 74 return False 75 76def require_sim_object(name, fatal=False): 77 """Test if a SimObject exists and abort/skip test if not. 78 79 Arguments: 80 name -- Name of SimObject (string) 81 82 Keyword arguments: 83 fatal -- Set to True to indicate that the test should fail 84 instead of being skipped. 85 """ 86 87 if has_sim_object(name): 88 return 89 else: 90 msg = "Test requires the '%s' SimObject." % name 91 if fatal: 92 m5.fatal(msg) 93 else: 94 skip_test(msg) 95 |
96# Since we're in batch mode, dont allow tcp socket connections 97m5.disableAllListeners() 98 99# single "path" arg encodes everything we need to know about test 100(category, mode, name, isa, opsys, config) = sys.argv[1].split('/')[-6:] 101 102# find path to directory containing this file 103tests_root = os.path.dirname(__file__) --- 66 unchanged lines hidden --- |