-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.py
59 lines (51 loc) · 1.7 KB
/
run.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
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Nico Epp and Ralf Funk
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
from waf import test_1_detection
from waf import test_3_training_time
from waf.test_2_waf_speed import data_server
from waf.test_2_waf_speed import destination
from waf.test_2_waf_speed import proxy_implementation
from waf.test_2_waf_speed import source
AVAILABLE_COMMANDS = '''{}
Available commands are:
test1
test2 dataserver
test2 destination
test2 proxy
test2 source
test3
'''
USAGE = AVAILABLE_COMMANDS.format('Usage: python run.py COMMAND')
FALSE_CMD = AVAILABLE_COMMANDS.format('"{}" is not an available command')
def run():
if len(sys.argv) > 1:
if sys.argv[1] == 'test1':
test_1_detection.run()
elif sys.argv[1] == 'test2':
if sys.argv[2] == 'dataserver':
data_server.run()
elif sys.argv[2] == 'destination':
destination.run()
elif sys.argv[2] == 'proxy':
proxy_implementation.run()
elif sys.argv[2] == 'source':
source.run()
else:
print(FALSE_CMD.format('test2 ' + sys.argv[2]))
elif sys.argv[1] == 'test3':
test_3_training_time.run()
elif sys.argv[1] == '-h' or sys.argv[1] == '--help':
print(USAGE)
else:
print(FALSE_CMD.format(sys.argv[1]))
else:
print(USAGE)
if __name__ == '__main__':
sys.path.extend(os.path.dirname(os.path.realpath(__file__)))
run()