Skip to content

Commit 179e6a6

Browse files
committed
add log cleanup script
1 parent 0377dd9 commit 179e6a6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

logs/cleanup.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# removes log dirs where only one test was run
3+
# because those are considered tests that are not interesting anymore
4+
5+
# Root directory containing the timestamp folders
6+
ROOT_DIR="."
7+
8+
# Loop through each main folder
9+
for dir in "$ROOT_DIR"/*/*; do
10+
# Check if it exists and is a directory
11+
[ -d "$dir" ] || continue
12+
13+
# Count the number of subdirectories (ignoring files)
14+
subdirs=($(find "$dir" -mindepth 1 -maxdepth 1 -type d))
15+
if [ ${#subdirs[@]} -le 1 ]; then
16+
# delete test type dirs
17+
rm -r "$dir"
18+
fi
19+
parent_dir=$(dirname $dir)
20+
subdirs=($(find "$parent_dir" -mindepth 1 -maxdepth 1 -type d))
21+
if [ ${#subdirs[@]} -eq 0 ]; then
22+
# delete parent folder
23+
rm "${parent_dir}/report.html"
24+
rmdir "${parent_dir}"
25+
fi
26+
done
27+
28+
#
29+
for dir in "${ROOT_DIR}"/*; do
30+
[ -d "${dir}" ] || continue
31+
32+
subdirs=($(find "$dir" -mindepth 1 -maxdepth 1 -type d))
33+
if [ ${#subdirs[@]} -eq 0 ]; then
34+
# delete parent folder
35+
rm "${dir}/report.html"
36+
rmdir "${dir}"
37+
fi
38+
done

0 commit comments

Comments
 (0)