3 * YAFFS: Yet another FFS. A NAND-flash specific file system.
5 * Copyright (C) 2002-2021 Aleph One Ltd.
7 * Created by Timothy Manning <timothy@yaffs.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
15 import subprocess, sys
17 test_list = ["is_yaffs_working_tests",
19 "64_and_32_bit_time/64_bit",
20 "64_and_32_bit_time/32_bit",
27 def run(makefile_paths):
29 for path in makefile_paths:
30 print("\nrunning test {}".format(path))
31 is_successful, test_output = run_makefile_test(path)
32 if is_successful != TEST_PASSED:
33 print('\033[41m' +'test {} failed'.format(path)+'\033[0m')
35 failed_tests.append( (path, is_successful) )
37 print('\033[42m' +"test passed"+'\033[0m')
40 def run_makefile_test(path):
42 subprocess.check_output("make -j -C {} test".format(path), shell=True)
43 except subprocess.CalledProcessError as e:
44 return (TEST_FAILED, e.output.decode('UTF-8'))
46 return (TEST_PASSED, "test passed")
48 if __name__ == "__main__":
50 failed_tests = run(test_list)
52 print("\ntest summary #############")
53 if len(failed_tests) == 0:
54 print('\033[42m' +"all tests passed"+'\033[0m')
56 for path, output in failed_tests:
57 print('\033[41m' +"test {} failed".format(path)+'\033[0m')
58 print('\033[41m' + "ran {} tests, {} failed".format(len(test_list), len(failed_tests))+'\033[0m')