-
Notifications
You must be signed in to change notification settings - Fork 21
/
format-class-masstest.sh
executable file
·53 lines (40 loc) · 1.45 KB
/
format-class-masstest.sh
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
#!/bin/bash
#
# Mass test for Java Class Viewer
# This script is trying to test on all the .class files in the JAVA_HOME/jmods/*.jmod files
# This script is designed to execute on Ubuntu Linux
#
# Parameter
# We can edit the JAVA_FOLDER variable in the script if want to test with other Java versions
#
# Java folder location, in Ubunut linux
JAVA_FOLDER="/usr/lib/jvm/default-java"
logtime() {
retval=$(date '+%Y-%m-%d.%T.%3N')
echo $retval
}
mkdir -p target/masstest
cd target/masstest && pwd
rm -rf *
touch masstest.cmds
find "$JAVA_FOLDER/jmods/" -iname *.jmod | while read jmodfilename; do
jmodfilename_nopath=$(basename -- "$jmodfilename")
jmodfilename_short="${jmodfilename_nopath%.*}"
echo "$(logtime) Processing $jmodfilename , filename=$jmodfilename_nopath shortfilename=$jmodfilename_short"
# Get and Extract the file
cp $jmodfilename .
unzip -q $jmodfilename_nopath -d $jmodfilename_short
# Processing each .class file
find $jmodfilename_short -iname *.class | while read classfilename; do
echo "timeout 5 java -Dorg.binaryinternals.masstestmode=true -jar ../../BinaryInternalsViewer/target/BinaryInternalsViewer-3.6.jar '$classfilename'" >> masstest.cmds
done
# Clean up .jmod file
rm $jmodfilename_nopath
done
echo "$(logtime) Commands sample"
tail -10 masstest.cmds
echo "$(logtime) Mass Test Starts"
parallel --ungroup -j 50% < masstest.cmds
# Go back
cd ../../
echo "$(logtime) Finished"