-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcheck_environment.py
54 lines (45 loc) · 1.5 KB
/
check_environment.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
"""
This file check if project is configured
"""
from subprocess import call, PIPE, check_output
from jsfuzz.utils.constants import (
chakra, v8, javascriptcore, spidermonkey, hermes
)
ERROR_MSG = """\n########## ENVIRONMENT ERROR ##########\n Error: {}\n##########"""
def is_engines_installed():
try:
call([javascriptcore, '--help'], stdout=PIPE, stderr=PIPE)
check_output([chakra, '--help'])
check_output([v8, '--help'])
check_output([spidermonkey, '--help'])
check_output([hermes, '--help'])
except OSError:
raise Exception(
ERROR_MSG.format(
"Engines not found. Check if v8, ch, jsc, sm and hermes"
"is installed in your PATH (see install_deps.sh)"
)
)
def is_radamsa_installed():
try:
call(["radamsa", "--version"], stdout=PIPE, stderr=PIPE)
except OSError:
raise Exception(
ERROR_MSG.format(
"Radamsa not found, please go to jsfuzz/README.md or\
install_deps.sh and see the instructions"
)
)
def is_quickfuzz_installed():
try:
call(["QuickFuzz", "--version"], stdout=PIPE, stderr=PIPE)
except OSError:
raise Exception(
ERROR_MSG.format(
"QuickFuzz not found, please go to jsfuzz/README.md or\
install_deps.sh and see the instructions"
)
)
is_engines_installed()
is_radamsa_installed()
is_quickfuzz_installed()