File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ TEST_FILE=" ANYTHING"
5+
6+ # List of commands to test
7+ CMDS=(
8+ " ls | wc"
9+ " tr -cs a-zA-Z '\n' < $TEST_FILE | uniq"
10+ " bzip2 -c < $TEST_FILE | wc -c"
11+ " gzip -c < $TEST_FILE | wc -c"
12+ " awk '{count[\$ 1]++} END {for (i in count) print count[i], i}' < $TEST_FILE "
13+ " sort -u < $TEST_FILE "
14+ " sort -rn < $TEST_FILE | tee /dev/null"
15+ " wc -lc < $TEST_FILE "
16+ " find . -type f | wc -l"
17+ " find . -type d | wc -l"
18+ " head -n 5 $TEST_FILE "
19+ " tail -n 5 $TEST_FILE "
20+ " cut -d: -f1 $TEST_FILE | sort | uniq -c"
21+ " cat $TEST_FILE | grep root"
22+ )
23+
24+
25+ i=0
26+ for cmd in " ${CMDS[@]} " ; do
27+ i=$(( i+ 1 ))
28+ echo " [$i ] $cmd "
29+
30+ # strace dump
31+ strace -y -f --seccomp-bpf -e %file,fork,clone -o " dump.txt" sh -c " $cmd "
32+
33+ # analyze with trace_v2
34+ python3 trace_v2.py " dump.txt" > " trace_v2_$i .txt" 2>&1
35+
36+ # run with trace_v3
37+ sudo ./target/debug/trace_v3 sh -c " $cmd " > " trace_v3_$i .txt" 2>&1
38+
39+ rm " ./dump.txt"
40+ done
You can’t perform that action at this time.
0 commit comments