|
134 | 134 | '''
|
135 | 135 | }
|
136 | 136 |
|
| 137 | +Test_Tests = { |
| 138 | +'module.json':'''{ |
| 139 | + "name": "test-tests", |
| 140 | + "version": "0.0.0", |
| 141 | + "description": "Test yotta's compilation of tests.", |
| 142 | + "keywords": [], |
| 143 | + "author": "James Crosby <james.crosby@arm.com>", |
| 144 | + "licenses": [ |
| 145 | + { |
| 146 | + "url": "https://spdx.org/licenses/Apache-2.0", |
| 147 | + "type": "Apache-2.0" |
| 148 | + } |
| 149 | + ], |
| 150 | + "dependencies": {}, |
| 151 | + "targetDependencies": {} |
| 152 | +}''', |
| 153 | +'source/foo.c':'''#include "stdio.h" |
| 154 | +int foo(){ |
| 155 | + printf("foo!\\n"); |
| 156 | + return 7; |
| 157 | +}''', |
| 158 | +'test-tests/foo.h':'int foo();', |
| 159 | +'test/a/bar.c':'#include "test-tests/foo.h"\nint main(){ foo(); return 0; }', |
| 160 | +'test/b/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 161 | +'test/b/b/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }', |
| 162 | +'test/c/a/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 163 | +'test/c/b/a/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }', |
| 164 | +'test/d/a/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 165 | +'test/d/a/b/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }', |
| 166 | +'test/e/a/a/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 167 | +'test/e/b/a/a/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }', |
| 168 | +'test/f/a/a/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 169 | +'test/f/a/b/a/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }', |
| 170 | +'test/g/a/a/a/bar.c':'#include "test-tests/foo.h"\nint bar(); int main(){ foo(); bar(); return 0; }', |
| 171 | +'test/g/a/a/b/bar.c':'#include "stdio.h"\nint bar(){ printf("bar!\\n"); return 7; }' |
| 172 | +} |
| 173 | + |
137 | 174 | def isWindows():
|
138 | 175 | # can't run tests that hit github without an authn token
|
139 | 176 | return os.name == 'nt'
|
@@ -171,20 +208,33 @@ def test_buildTrivialExe(self):
|
171 | 208 | rmRf(test_dir)
|
172 | 209 |
|
173 | 210 | @unittest.skipIf(isWindows(), "can't build natively on windows yet")
|
174 |
| - def test_buildZComplex(self): |
| 211 | + def test_buildComplex(self): |
175 | 212 | test_dir = self.writeTestFiles(Test_Complex)
|
176 | 213 |
|
177 | 214 | stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
|
178 | 215 |
|
179 | 216 | rmRf(test_dir)
|
180 | 217 |
|
181 | 218 | @unittest.skipIf(isWindows(), "can't build natively on windows yet")
|
182 |
| - def test_buildZZComplexSpaceInPath(self): |
| 219 | + def test_buildComplexSpaceInPath(self): |
183 | 220 | test_dir = self.writeTestFiles(Test_Complex, True)
|
184 | 221 |
|
185 | 222 | stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir)
|
186 | 223 |
|
187 | 224 | rmRf(test_dir)
|
| 225 | + |
| 226 | + @unittest.skipIf(isWindows(), "can't build natively on windows yet") |
| 227 | + def test_buildTests(self): |
| 228 | + test_dir = self.writeTestFiles(Test_Tests, True) |
| 229 | + stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'build'], test_dir) |
| 230 | + stdout = self.runCheckCommand(['--target', systemDefaultTarget(), 'test'], test_dir) |
| 231 | + self.assertIn('test-a', stdout) |
| 232 | + self.assertIn('test-c', stdout) |
| 233 | + self.assertIn('test-d', stdout) |
| 234 | + self.assertIn('test-e', stdout) |
| 235 | + self.assertIn('test-f', stdout) |
| 236 | + self.assertIn('test-g', stdout) |
| 237 | + rmRf(test_dir) |
188 | 238 |
|
189 | 239 |
|
190 | 240 | def runCheckCommand(self, args, test_dir):
|
|
0 commit comments