From 607ef28aadb281ab61a2be493a637126e967a388 Mon Sep 17 00:00:00 2001 From: wuestholz Date: Thu, 29 May 2014 21:41:00 +0200 Subject: Set up the same test infrastructure as in Boogie. --- Test/clean.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Test/clean.py (limited to 'Test/clean.py') diff --git a/Test/clean.py b/Test/clean.py new file mode 100644 index 00000000..37166b61 --- /dev/null +++ b/Test/clean.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +""" +This is a convenient script to delete temporary files created by the lit and +legacy testing infrastructure. Both systems use the same name for Output +unfortunately so this script needs to be run before switching to the other +infrastructure. +""" +import logging +import os +import shutil +import sys + +_name = 'Output' + +def main(): + logging.basicConfig(level=logging.INFO) + root = os.path.abspath(os.path.dirname(__file__)) + logging.info('Cleaning "{}"'.format(root)) + count = 0 + + for (dirpath, dirnames, filenames) in os.walk(root): + rmpath = os.path.join(dirpath, _name) + if _name in dirnames: + logging.info('Deleting lit temporary directory "{}"'.format(rmpath)) + shutil.rmtree(rmpath) + count += 1 + elif _name in filenames: + logging.info('Deleting batch testing output file "{}"'.format(os.path.join(dirpath, _name))) + os.remove(rmpath) + count += 1 + + logging.info('\n\nDONE: Removed {}'.format(count)) + +if __name__ == '__main__': + sys.exit(main()) -- cgit v1.2.3