-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunAll.sh
More file actions
executable file
·40 lines (32 loc) · 900 Bytes
/
runAll.sh
File metadata and controls
executable file
·40 lines (32 loc) · 900 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
TEST_FILE="ANYTHING"
# List of commands to test
CMDS=(
"ls | wc"
"tr -cs a-zA-Z '\n' < $TEST_FILE | uniq"
"bzip2 -c < $TEST_FILE | wc -c"
"gzip -c < $TEST_FILE | wc -c"
"awk '{count[\$1]++} END {for (i in count) print count[i], i}' < $TEST_FILE"
"sort -u < $TEST_FILE"
"sort -rn < $TEST_FILE | tee /dev/null"
"wc -lc < $TEST_FILE"
"find . -type f | wc -l"
"find . -type d | wc -l"
"head -n 5 $TEST_FILE"
"tail -n 5 $TEST_FILE"
"cut -d: -f1 $TEST_FILE | sort | uniq -c"
"cat $TEST_FILE | grep root"
)
i=0
for cmd in "${CMDS[@]}"; do
i=$((i+1))
echo "[$i] $cmd"
# strace dump
strace -y -f --seccomp-bpf -e %file,fork,clone -o "dump.txt" sh -c "$cmd"
# analyze with trace_v2
python3 trace_v2.py "dump.txt" > "trace_v2_$i.txt" 2>&1
# run with trace_v3
sudo ./target/debug/trace_v3 sh -c "$cmd" > "trace_v3_$i.txt" 2>&1
rm "./dump.txt"
done