123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #!/usr/bin/python3
- # Script for automatically run tests on samples
- # author: sana
- # contributor: cristi
- import subprocess
- import sys
- # list of data structures
- teste = ["algorithms",
- "avl_tree",
- "b_tree",
- "binary_search_tree",
- "binary_tree",
- "doubly_linked_list",
- "hash_map",
- "hash_set",
- "heap",
- "interval_tree",
- "linked_list",
- "matrix",
- "graph",
- "graph_matrix",
- "pair",
- "queue",
- "red_black_tree",
- "scapegoat_tree",
- "skip_list",
- "sort",
- "splay_tree",
- "stack",
- "treap_tree",
- "tree_algorithms",
- "tree",
- "trie_tree",
- "vector"]
- EXEC = "./temelia_samples "
- CROSS_COMPILE = ""
- subprocess.call("make clean", shell=True)
- for arg in sys.argv:
- if (arg == 'dll'):
- subprocess.call("cp /usr/lib/temelia.dll .", shell=True)
- EXEC = "./temelia_samples.exe "
- CROSS_COMPILE = " CROSS_COMPILE=i586-mingw32msvc-"
- subprocess.call("make" + CROSS_COMPILE, shell=True)
- LOG_FILE = "log_samples"
- flog = open(LOG_FILE, 'w')
- # no. of failed and passed tests
- failed = 0
- passed = 0
- print("* Testing samples...")
- for test in teste:
- # log each test's output
- flog.write('* Test ' + test + ' begins...\n' )
- flog.write('* Test ' + test + ' ended.\t')
- if (subprocess.call(EXEC + test + " >> " + LOG_FILE, shell=True) != 0):
- print('FAILED Test [' + test + ']')
- flog.write(' [failed]\n')
- failed += 1
- else:
- print('PASSED Test [' + test + ']')
- flog.write(' [passed]\n')
- passed += 1
-
- print("Done.")
- print('Statistics: ' + str(failed) + ' failed tests' + ' | ' + \
- str(passed) + ' passed tests.')
- print('See log file ' + LOG_FILE)
|