forked from Trusted-AI/adversarial-robustness-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·164 lines (113 loc) · 6.79 KB
/
run_tests.sh
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/env bash
exit_code=0
# attacks
python -m unittest 'tests/attacks/test_adversarial_patch.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_adversarial_patch.py'; fi
python -m unittest 'tests/attacks/test_boundary.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_boundary.py'; fi
python -m unittest 'tests/attacks/test_carlini.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_carlini.py'; fi
python -m unittest 'tests/attacks/test_decision_tree_attack.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_decision_tree_attack.py'; fi
python -m unittest 'tests/attacks/test_deepfool.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_deepfool.py'; fi
python -m unittest 'tests/attacks/test_elastic_net.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_elastic_net.py'; fi
python -m unittest 'tests/attacks/test_fast_gradient.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_fast_gradient.py'; fi
python -m unittest 'tests/attacks/test_functionally_equivalent_extraction.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_functionally_equivalent_extraction.py'; fi
python -m unittest 'tests/attacks/test_hclu.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_hclu.py'; fi
python -m unittest 'tests/attacks/test_hop_skip_jump.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_hop_skip_jump.py'; fi
python -m unittest 'tests/attacks/test_iterative_method.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_iterative_method.py'; fi
python -m unittest 'tests/attacks/test_newtonfool.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_newtonfool.py'; fi
python -m unittest 'tests/attacks/test_poisoning_attack_svm.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_poisoning_attack_svm.py'; fi
python -m unittest 'tests/attacks/test_projected_gradient_descent.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_projected_gradient_descent.py'; fi
python -m unittest 'tests/attacks/test_saliency_map.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_saliency_map.py'; fi
python -m unittest 'tests/attacks/test_spatial_transformation.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_spatial_transformation.py'; fi
python -m unittest 'tests/attacks/test_universal_perturbation.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_universal_perturbation.py'; fi
python -m unittest 'tests/attacks/test_virtual_adversarial.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_virtual_adversarial.py'; fi
python -m unittest 'tests/attacks/test_zoo.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_zoo.py'; fi
# classifiers
python -m unittest 'tests/classifiers/test_blackbox.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_blackbox.py'; fi
python -m unittest 'tests/classifiers/test_catboost.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_catboost.py'; fi
python -m unittest 'tests/classifiers/test_classifier.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_classifier.py'; fi
python -m unittest 'tests/classifiers/test_detector_classifier.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_detector_classifier.py'; fi
python -m unittest 'tests/classifiers/test_ensemble.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_ensemble.py'; fi
python -m unittest 'tests/classifiers/test_GPy.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_GPy.py'; fi
python -m unittest 'tests/classifiers/test_keras.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_keras.py'; fi
python -m unittest 'tests/classifiers/test_keras_tf.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_keras_tf.py'; fi
python -m unittest 'tests/classifiers/test_lightgbm.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_lightgbm.py'; fi
python -m unittest 'tests/classifiers/test_mxnet.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_mxnet.py'; fi
python -m unittest 'tests/classifiers/test_pytorch.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_pytorch.py'; fi
python -m unittest 'tests/classifiers/test_scikitlearn.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_scikitlearn.py'; fi
python -m unittest 'tests/classifiers/test_tensorflow.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_tensorflow.py'; fi
python -m unittest 'tests/classifiers/test_tensorflow_v2.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_tensorflow_v2.py'; fi
python -m unittest 'tests/classifiers/test_xgboost.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_xgboost.py'; fi
# defences
python -m unittest discover tests/defences -p 'test_*.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed tests/defences'; fi
# detection
python -m unittest discover tests/detection -p 'test_*.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed tests/detection'; fi
# poison detection
python -m unittest discover tests/poison_detection -p 'test_*.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed tests/poison_detection'; fi
# wrappers
python -m unittest 'tests/wrappers/test_expectation.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_expectation.py'; fi
python -m unittest 'tests/wrappers/test_output_add_random_noise.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_output_add_random_noise.py'; fi
python -m unittest 'tests/wrappers/test_output_class_labels.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_output_class_labels.py'; fi
python -m unittest 'tests/wrappers/test_output_high_confidence.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_output_high_confidence.py'; fi
python -m unittest 'tests/wrappers/test_output_reverse_sigmoid.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_output_reverse_sigmoid.py'; fi
python -m unittest 'tests/wrappers/test_output_rounded.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_output_rounded.py'; fi
python -m unittest 'tests/wrappers/test_query_efficient_bb.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_query_efficient_bb.py'; fi
python -m unittest 'tests/wrappers/test_randomized_smoothing.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_randomized_smoothing.py'; fi
python -m unittest 'tests/wrappers/test_expectation.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_wrapper.py'; fi
# generators
python -m unittest tests.test_data_generators
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_data_generators'; fi
# metrics
python -m unittest discover tests/metrics -p 'test_*.py'
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed tests/metrics'; fi
# utils
python -m unittest tests.test_utils
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_utils'; fi
# visualization
python -m unittest tests.test_visualization
if [[ $? -ne 0 ]]; then exit_code=1; echo 'Failed test_visualization'; fi
exit $exit_code