Skip to content

Commit

Permalink
Minor fixes for smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsamersoff authored and Andrei Pangin committed Oct 5, 2017
1 parent 37590a2 commit bd49b2c
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions test/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@
set -e # exit on any failure
set -x # print all executed lines

pushd $(dirname $0)
if [ -z "${JAVA_HOME}" ]
then
echo "JAVA_HOME is not set"
fi

javac Target.java
java Target &
(
cd $(dirname $0)

FILENAME=/tmp/java.trace
JAVAPID=$!
if [ "Target.class" -ot "Target.java" ]
then
${JAVA_HOME}/bin/javac Target.java
fi

sleep 1 # allow the Java runtime to initialize
../profiler.sh -f $FILENAME -o collapsed -d 5 $JAVAPID
${JAVA_HOME}/bin/java Target &

kill $JAVAPID
FILENAME=/tmp/java.trace
JAVAPID=$!

function assert_string() {
if ! grep -q "$1" $FILENAME; then
exit 1
fi
}
sleep 1 # allow the Java runtime to initialize
../profiler.sh -f $FILENAME -o collapsed -d 5 $JAVAPID

kill $JAVAPID

assert_string "Target.main;Target.method1 "
assert_string "Target.main;Target.method2 "
assert_string "Target.main;Target.method3;java/util/Scanner"
function assert_string() {
if ! grep -q "$1" $FILENAME; then
exit 1
fi
}

popd
assert_string "Target.main;Target.method1 "
assert_string "Target.main;Target.method2 "
assert_string "Target.main;Target.method3;java/util/Scanner"
)

0 comments on commit bd49b2c

Please sign in to comment.