Skip to content

Commit 3ef4847

Browse files
committed
Added remove step in tests to force rebuild
Found by user iamscottmoyers, this was an interesting bug with the test system. If the new test.c file is generated fast enough, it may not have a new timestamp and not get recompiled. To fix, we can remove the specific files that need to be rebuilt (lfs and test.o).
1 parent f694b14 commit 3ef4847

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ def generate(test):
2121
else:
2222
lines.append(line)
2323

24+
# Create test file
2425
with open('test.c', 'w') as file:
2526
file.write(template.format(tests='\n'.join(lines)))
2627

28+
# Remove build artifacts to force rebuild
29+
try:
30+
os.remove('test.o')
31+
os.remove('lfs')
32+
except OSError:
33+
pass
34+
2735
def compile():
2836
os.environ['CFLAGS'] = os.environ.get('CFLAGS', '') + ' -Werror'
2937
subprocess.check_call(['make', '--no-print-directory', '-s'], env=os.environ)

0 commit comments

Comments
 (0)