-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare.py
executable file
·70 lines (51 loc) · 2.5 KB
/
prepare.py
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
70
import os
# Change directory to 'php-src' where PHP source code is located
os.chdir("./php-src/")
# Create a directory to store merged test files
os.system("mkdir ./tests/merged/")
# Path to the log file that contains a list of PHPT file paths
phpts_filepath = "/tmp/flowfusion-prepare.log"
# Read the PHPT file paths from the log file
with open(phpts_filepath, "r") as f:
phpts = f.read().strip("\n").split("\n")
# Begin preparing PHPT seeds
print("Preparing PHPT seeds")
for each_phpt in phpts:
# Move each PHPT file from its current location to the 'phpt_seeds' directory
os.system(f"mv {each_phpt} ../phpt_seeds/")
print("PHPT seeds are ready")
# List to store the unique folders that contain PHPT files
folders = []
# Extract folder paths from the list of PHPT files
for eachline in phpts:
folder = "/".join(eachline.split("/")[:-1]) + "/"
if folder not in folders:
folders.append(folder)
# Begin preparing dependencies by copying required files from each folder
print("Preparing dependencies")
for each_folder in folders:
if each_folder=='/':
continue
# Copy all files from each folder to 'phpt_deps' directory
os.system(f"cp -r {each_folder}* ../phpt_deps 2>/dev/null")
print("Dependencies are ready")
print("===start configuring===")
os.system("./buildconf")
os.system('CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug --enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-fpm --enable-litespeed --enable-phpdbg-debug --enable-zts --enable-bcmath --enable-calendar --enable-dba --enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test --with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap --with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip')
print("configuring finished")
print("start compiling")
os.system("make -j16 --silent")
print("compiling finished")
if os.path.exists("./sapi/cli/php"):
print("compile finished!")
else:
print("compile failed!")
exit(-1)
os.chdir("../knowledges/")
print("preparing knowledges")
os.system("../php-src/sapi/cli/php ./function.php")
os.system("python3 function.py")
os.system("../php-src/sapi/cli/php ./class.php")
os.system("python3 class.py")
os.system("python3 seed-preprocessing.py")
print("all ready!")