Testsuite cleanup can delete everything
If you run ./hadrian/build test
and press Ctrl-C at an unfortunate moment, it deletes the entire repository (!).
I encountered this by accident. After looking at the traceback and adding pauses in random places, I reproduced it a couple more times, but it is rare.
When the test ends, we call cleanup()
in testlib.py
:
shutil.rmtree(str(testdir), ignore_errors=False)
where the test directory in testglobals.py
is initialized to:
self.testdir = Path('.')
The code later overwrites testdir
with a temporary directory. Unless you press Ctrl-C.