-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
127 lines (114 loc) · 4.63 KB
/
Jenkinsfile
File metadata and controls
127 lines (114 loc) · 4.63 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'figitlab']])
if(env.JOB_NAME =~ 'ttproto-unittest/'){
node('docker'){
env.TEST_FILE_TAT_COAP_COMMON="tests/test_tat/test_common.py"
env.TEST_FILE_TAT_COAP_CORE="tests/test_tat/test_tat_coap_core.py"
env.TEST_FILE_TAT_COAP_OBSERVE="tests/test_tat/test_tat_coap_observe.py"
env.TEST_FILE_TAT_COAP_BLOCK="tests/test_tat/test_tat_coap_block.py"
env.TEST_FILE_DISSECTOR_TESTS="tests/test_dissector/"
env.TEST_FILE_DISSECTOR_TESTS_6LOWPAN="tests/test_dissector/test_dissector_pcaps_6lowpan.py"
env.TEST_FILE_DISSECTOR_TESTS_COAP="tests/test_dissector/test_dissector_pcaps_coap.py"
env.TEST_FILE_DISSECTOR_TESTS_IEEE802154="tests/test_dissector/test_dissector_pcaps_802154.py"
env.TEST_FILE_ANALYZER_TESTS="tests/test_analyzer/"
stage ("Setup dependencies"){
checkout scm
sh 'git submodule update --init'
withEnv(["DEBIAN_FRONTEND=noninteractive"]){
sh '''
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install --fix-missing -y python3-dev python3-pip python3-setuptools
sudo -H python3 -m pip install --user --upgrade pip
'''
/* Show deployed code */
/* sh "tree ." */
}
}
stage("check python version"){
sh '''
python3 --version
'''
}
stage("virtualenv and requirements installs"){
withEnv(["DEBIAN_FRONTEND=noninteractive"]){
sh '''
python3 -m pip install --user virtualenv
python3 -m virtualenv -p python3 /tmp/venv
. /tmp/venv/bin/activate
python3 -m pip install pytest --ignore-installed
python3 -m pip install -r requirements.txt --upgrade
'''
}
}
stage("TAT frames-pre-processing unittesting"){
sh '''
. /tmp/venv/bin/activate
python3 -m unittest $TEST_FILE_TAT_COAP_COMMON -vvv
'''
}
stage("TAT CoAP unittesting"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_TAT_COAP_COMMON \\
$TEST_FILE_TAT_COAP_CORE \\
$TEST_FILE_TAT_COAP_OBSERVE \\
$TEST_FILE_TAT_COAP_BLOCK \\
--pastebin=all
'''
}
stage("Analyzer unittesting"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_ANALYZER_TESTS \\
'''
}
stage("Dissector unittesting"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_DISSECTOR_TESTS \\
--ignore=$TEST_FILE_DISSECTOR_TESTS_6LOWPAN \\
--ignore=$TEST_FILE_DISSECTOR_TESTS_COAP \\
--ignore=$TEST_FILE_DISSECTOR_TESTS_IEEE802154 \\
'''
}
stage("Dissector - 6LoWPAN test"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_DISSECTOR_TESTS_6LOWPAN \\
'''
}
stage("Dissector - CoAP test"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_DISSECTOR_TESTS_COAP \\
'''
}
stage("Dissector - IEEE802.15.4 test"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv \\
$TEST_FILE_DISSECTOR_TESTS_IEEE802154 \\
'''
}
stage("unittesting rest of component"){
sh '''
. /tmp/venv/bin/activate
python3 -m pytest -p no:cacheprovider -vvv tests/ \\
--ignore=$TEST_FILE_TAT_COAP_COMMON \\
--ignore=$TEST_FILE_TAT_COAP_CORE \\
--ignore=$TEST_FILE_TAT_COAP_OBSERVE \\
--ignore=$TEST_FILE_TAT_COAP_BLOCK \\
--ignore=tests/test_webserver/tests.py \\
--ignore=tests/test_tat/test_webserver.py \\
--ignore=$TEST_FILE_DISSECTOR_TESTS \\
--ignore=$TEST_FILE_ANALYZER_TESTS \\
'''
}
}
}