misc: Updated the RELEASE-NOTES and version number
[gem5.git] / tests / gem5 / hello_se / test_hello_se.py
1 # Copyright (c) 2020 The Regents of the University of California
2 # All Rights Reserved.
3 #
4 # Copyright (c) 2020 ARM Limited
5 # All rights reserved
6 #
7 # The license below extends only to copyright in the software and shall
8 # not be construed as granting a license to any other intellectual
9 # property including but not limited to intellectual property relating
10 # to a hardware implementation of the functionality of the software
11 # licensed hereunder. You may use the software subject to the license
12 # terms below provided that you ensure that this notice is replicated
13 # unmodified and in its entirety in all distributions of the software,
14 # modified or unmodified, in source code or in binary form.
15 #
16 # Copyright (c) 2017 Mark D. Hill and David A. Wood
17 # All rights reserved.
18 #
19 # Redistribution and use in source and binary forms, with or without
20 # modification, are permitted provided that the following conditions are
21 # met: redistributions of source code must retain the above copyright
22 # notice, this list of conditions and the following disclaimer;
23 # redistributions in binary form must reproduce the above copyright
24 # notice, this list of conditions and the following disclaimer in the
25 # documentation and/or other materials provided with the distribution;
26 # neither the name of the copyright holders nor the names of its
27 # contributors may be used to endorse or promote products derived from
28 # this software without specific prior written permission.
29 #
30 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
42 '''
43 Test file for the util m5 exit assembly instruction.
44 '''
45 from testlib import *
46
47 static_progs = {
48 'x86': ('hello64-static', 'hello32-static'),
49 'arm': ('hello64-static', 'hello32-static'),
50 'mips': ('hello',),
51 'riscv': ('hello',),
52 'sparc': ('hello',)
53 }
54
55 dynamic_progs = {
56 'x86': ('hello64-dynamic',)
57 }
58
59 cpu_types = {
60 'x86': ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
61 'arm' : ('TimingSimpleCPU', 'AtomicSimpleCPU','DerivO3CPU'),
62 'mips' : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
63 'riscv' : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU', 'MinorCPU'),
64 'sparc' : ('TimingSimpleCPU', 'AtomicSimpleCPU')
65 }
66
67 supported_os = {
68 'x86': ('linux',),
69 'arm' : ('linux',),
70 'mips' : ('linux',),
71 'riscv' : ('linux',),
72 'sparc' : ('linux',)
73 }
74
75 # We only want to test x86, arm, and riscv on quick. Mips and sparc will be
76 # left for long.
77 os_length = {
78 'x86': constants.quick_tag,
79 'arm' : constants.quick_tag,
80 'mips' : constants.long_tag,
81 'riscv' : constants.quick_tag,
82 'sparc' : constants.long_tag,
83 }
84
85 base_path = joinpath(config.bin_path, 'hello')
86
87 urlbase = config.resource_url + '/test-progs/hello/bin/'
88
89 ref_path = joinpath(getcwd(), 'ref')
90 verifiers = (
91 verifier.MatchStdoutNoPerf(joinpath(ref_path, 'simout')),
92 )
93
94 def verify_config(isa, binary, operating_s, cpu, hosts):
95 url = urlbase + isa + '/' + operating_s + '/' + binary
96 path = joinpath(base_path, isa, operating_s)
97 hello_program = DownloadedProgram(url, path, binary)
98
99 gem5_verify_config(
100 name='test-' + binary + '-' + operating_s + "-" + cpu,
101 fixtures=(hello_program,),
102 verifiers=verifiers,
103 config=joinpath(config.base_dir, 'configs', 'example','se.py'),
104 config_args=['--cmd', joinpath(path, binary), '--cpu-type', cpu,
105 '--caches'],
106 valid_isas=(isa.upper(),),
107 valid_hosts=hosts,
108 length = os_length[isa],
109 )
110
111 # Run statically linked hello worlds
112 for isa in static_progs:
113 for binary in static_progs[isa]:
114 for operating_s in supported_os[isa]:
115 for cpu in cpu_types[isa]:
116 verify_config(isa, binary, operating_s, cpu,
117 constants.supported_hosts)
118
119 # Run dynamically linked hello worlds
120 for isa in dynamic_progs:
121 for binary in dynamic_progs[isa]:
122 for operating_s in supported_os[isa]:
123 for cpu in cpu_types[isa]:
124 verify_config(isa, binary, operating_s, cpu,
125 constants.target_host[isa.upper()])