12 # - list #2 (if needed)
14 # Index 0 is always for the Python script itself
16 jpfLogDir = sys.argv[2]
18 firstList = sys.argv[4]
20 # PART 1: Generate the permutations of app pairs
21 print "PHASE 1: Extracting the app pairs from the app lists ...\n"
24 # Extract the first list
25 extractAppList = open(firstList, "r")
26 for app in extractAppList:
28 appList1.append(app.strip())
29 extractAppList.close()
34 # Extract the second list if provided (this is for combinations between two lists)
35 if (len(sys.argv) == 6):
36 secondList = sys.argv[5]
37 extractAppList = open(secondList, "r")
38 for app in extractAppList:
40 appList2.append(app.strip())
41 extractAppList.close()
43 # Just copy the first list to the second list
47 if useSecondList is False:
48 # Generate the permutations of pairs
49 for i in range(len(appList1)):
50 for j in range(i + 1, len(appList2)):
51 appPairs.append((appList1[i], appList2[j]))
53 # Generate pairs from 2 lists
54 for i in range(len(appList1)):
55 for j in range(len(appList2)):
56 # Skip if both are the same
57 if appList1[i] == appList2[j]:
59 appPairs.append((appList1[i], appList2[j]))
62 print "PHASE 2: Running JPF ...\n"
63 # List down all the log file names
64 writeLogList = open(jpfLogDir + "logList", "w+")
67 # Copy apps into Extractor/App1 and Extractor/App2
68 print "==> First app: %s" % item[0]
69 print "==> Second app: %s" % item[1]
70 os.system("cp " + appDir + item[0] + " Extractor/App1/App1.groovy")
71 os.system("cp " + appDir + item[1] + " Extractor/App2/App2.groovy")
73 # Run Runner.py to extract things and create main.groovy, then compile it
74 print "==> Compiling the apps ...\n"
75 os.system("make Runner")
76 os.system("make main")
79 print "==> Calling JPF and generate logs ...\n"
80 logName = item[0] + "--" + item[1] + ".log"
81 writeLogList.write(logName + "\n")
82 os.system("cd " + jpfDir + ";./run.sh " + jpfLogDir + logName + " main.jpf")