This repository has been archived by the owner on Oct 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest
executable file
·103 lines (87 loc) · 3.24 KB
/
test
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
#!/usr/bin/env bash
if [ -z "${SAQ_HOME}" ]
then
echo "missing env var SAQ_HOME"
exit 1
fi
cd "${SAQ_HOME}" || { echo "cannot cd to ${SAQ_HOME}"; exit 1; }
if [ -f "logs/unittest.log" ]
then
rm logs/unittest.log
fi
if [ -d data_unittest/error_reports ]
then
rm -rf data_unittest/error_reports && mkdir data_unittest/error_reports
fi
# if we passed no parameters then we run all the tests
if [ "$#" -eq "0" ]
then
PYTHONPATH=lib python3 -W ignore -m unittest -f -v \
saq.collectors.test \
saq.collectors.test_http \
saq.collectors.test_email \
saq.collectors.test_smtp \
saq.test_email \
saq.test_observables \
saq.test_crawlphish \
saq.test_crypto \
saq.test_analysis \
saq.test_database \
saq.test_util \
saq.test_locks \
saq.remediation.test \
saq.remediation.phishfry.test \
saq.messaging.test \
saq.engine.test \
saq.modules.test_alerts \
saq.modules.test_asset \
saq.modules.test_cloudphish \
saq.modules.test_url \
saq.modules.test_file_analysis \
saq.modules.test_email \
saq.modules.test_http \
saq.modules.test_crits \
saq.modules.test_intel \
api.analysis.test \
api.engine.test \
api.cloudphish.test \
api.events.test \
test_ace_api \
#saq.collectors.test_cb_binaries \
# TODO reintroduce these next two somehow
#saq.engine.test_cloudphish \
#saq.test_detection \
#saq.test_pds \
#saq.modules.test_pds \
#saq.modules.test_vx \
# no longer a thing
#saq.engine.test_email \
#saq.engine.test_ace \
#saq.test_lock \
exit 0
fi
# otherwise we run whatever test is specified on the command line
PYTHONPATH=lib python3 -W ignore -m unittest -f -v $1
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.engine.test_cloudphish.CloudPhishEngineTestCase.test_cloudphish_engine_007_http_clear_alert
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.modules.test_asset.AssetAnalysisModuleTestCase.test_carbon_black_asset_ident_000
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.engine.test_ace.ACECoreEngineTestCase.test_ace_engine_002_persistent_engine
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.engine.test_email.EmailEngineTestCase.test_email_engine_003_email_processing
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.engine.test_engine.EngineTestCase.test_engine_024_mysql_engine_submit
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.test_analysis.RootAnalysisTestCase.test_analysis_004_has_observable
#PYTHONPATH=lib python3 -W ignore -m unittest -v saq.test_database.DatabaseTestCase.test_database_007_caching_processes
if [ -f logs/unittest.log ]
then
GREP_COLORS='mt=01;103' grep --color=always \\[WARNING\\] logs/unittest.log
GREP_COLORS='mt=01;31' grep --color=always \\[ERROR\\] logs/unittest.log
GREP_COLORS='mt=01;32' grep --color=always MARKER logs/unittest.log
fi
if [ -d $data_dir/error_reports ]
then
if [ $( ls $data_dir/error_reports | wc -l ) -gt "0" ]
then
echo
echo "*** ERRORS REPORTED ** "
echo
cat $data_dir/error_reports/* 2> /dev/null
fi
fi