-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathassesstests
executable file
·84 lines (66 loc) · 1.75 KB
/
assesstests
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
#!/bin/bash
IFS=$'\n'
testeddir="temp"
findroot_identify_check() {
e="$(cat "$1/"'!'"stderr")"
[ -n "$e" ] && {
echo "$1" >&2
return
}
l="$(cat "$1/"'!'"stdout")"
o="$(tail -n1 <<< "$l")"
[ -z "$o" -o "$o" = "None" -o "$(wc -l <<< "$l")" -ne '2' ] &&
echo "$1" >&2
}
findbad() {
cd "$testeddir"
for i in $(find -mindepth 1 -maxdepth 1 -type d -name '*findroot' -printf '%f\n')
do
for j in $(find "$i" -maxdepth 1 -mindepth 1 -type d)
do
findroot_identify_check "$j"
done
done
for i in $(find identify -mindepth 1 -maxdepth 1 -type d)
do
findroot_identify_check "$i"
done
for i in $(find -mindepth 1 -maxdepth 1 -type d \! \( -name '*findroot' -o -name 'identify' \) -printf '%f\n' )
do
for j in $(find "$i" -maxdepth 1 -mindepth 1)
do
[ "$(find "$j" -type f | wc -l)" -le 2 ] &&
echo "$j" >&2
find "$j" -type f -size 0c \! -name '*!*' >&2
done
done
cd ..
}
getbad() {
{
tt1="$(mktemp)"
tt2="$(mktemp)"
trap 'rm "$tt1" "$tt2"' HUP INT QUIT TERM PWR EXIT
sed -n '
/^tested_urls = /{
:x
p
n
/^}$/!bx
}
' tests.py | sed -n '/^ *"[^"]*",$/{s/"//g;s/,$//;s/^ *//;p}' | sort -u | python -c '
import hashlib
import sys
def strtosha256(string):
if isinstance(string, str):
string = string.encode()
return hashlib.sha256(string).hexdigest()
for i in sys.stdin:
n = i.strip()
print(strtosha256(n),n)
' | sort -u > "$tt1"
findbad |& sed -E 's#(.*)/([^/]+)#\2 \1#' | sort -u > "$tt2"
join "$tt2" "$tt1"
} | sed -E 's#^(.+) (.+) (.+)$#\2/\1 \3#'
}
getbad