/
randoop.in
executable file
·44 lines (40 loc) · 1.71 KB
/
randoop.in
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
#!/bin/sh
#
# @author e1528532 <e1528532@libelektra.org>
# @brief run randoop on the jna bindings
# @date 29.10.2017
# @tags test java jna
#
# Executes the test generation tool randoop (https://randoop.github.io/randoop/)
# against the jna bindings with a standard configuration.
#
# Needs java to be accessible in the environment.
# Furthermore it expects the complete randoop bundle including its dependencies,
# which is called randoop-all-<version>.jar . It can be obtained from the randoop
# website mentioned above.
# By default it expects randoop-all-3.1.5.jar to be located in this directory.
# The jna bindings are expected to be in /usr/share/java on linux and
# /usr/local/share/java on macOS.
#
# You can pass a custom location for the two files by calling this script like:
#
# ./randoop [path to randoop jar] [path to libelektra jar]
# e.g.
# ./randoop /Users/admin/Downloads/randoop-3.1.5/randoop-all-3.1.5.jar \
# /usr/local/share/java/libelektra5j-0.8.19.jar
#
# In case you have the required files in the standard paths, simply call ./randoop
#
RANDOOP="${1:-randoop-all-3.1.5.jar}"
stringContain() { [ -z "${2##*$1*}" ] && ([ -z "$1" ] || [ -n "$2" ]); }
if stringContain "Darwin" "$(uname)"; then
BINDINGS="${2:-/usr/local/share/java/libelektra-@KDB_VERSION@.jar}"
else
BINDINGS="${2:-/usr/share/java/libelektra-@KDB_VERSION@.jar}"
fi
CLASSPATH="${BINDINGS}:${RANDOOP}"
# The non-public members are not intended for users of the bindings. Those are
# native function calls to the elektra library and calling them randomly like
# randoop would do may result in jvm segmentation faults.
java -ea -classpath "${CLASSPATH}" randoop.main.Main gentests \
--classlist=randoopClasses.txt --timelimit=120 --only-test-public-members=true