summaryrefslogtreecommitdiff
path: root/TC/making_new_tet_scen.py
blob: 6c5b84543b8e1b3a1472bb5124bcd898f5f1b711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python

#############################################
# tet_scen  auto generator
#
# ** argv[1] = TC root
#############################################

import sys,string,os


write_file = open("tet_scen", 'w')

#
# making new tet_scen
#
def making_tet_scen (filename):
	#tmp_list = filename.strip().split('/')
	n_filename = filename.replace(' ', '\\ ')
	#print n_filename
	#new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6]
	new_path = "/"+n_filename[:-6]
	#print new_path
	file = open(filename, 'r')
	lines = file.readlines()
	for line in lines:
		if len(line.strip()) > 1:
			list = line.strip().split('/')
			#print new_path + list[-1]
			write_file.write("\t"+new_path+list[-1]+"\n")

#
# usage()
#
def usage():
	print(" ")
	print("./making_new_tet_scen.py tc_root")
	print("Put the Test Case's root directory.")
	print("Do not include '/' at the end")
	print(" ")

#
# main()
#
def main():
	if len(sys.argv) < 2:
		usage()
		sys.exit(0)
		
	os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt')
	
	#write_file = open("tetscen", w)
	write_file.write("# auto generated tet_scen\n")
	write_file.write("all\n")
	write_file.write("\t\"Starting Full Test Suite\"\n")
	
	for file in open("tslist.txt", 'r'):
		#print file.strip()
		making_tet_scen(file.strip())
			
	write_file.write("\t\"Completed Full Test Suite\"\n")
	write_file.write("# EOF\n")
	write_file.close()
	print(" ")
	print("==============================")
	print("New tet_scen file is made~~~~")
	print("==============================")
	print(" ")
main()