2012-04-23 08:55:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for Serval DNA JNI entry points.
|
|
|
|
#
|
|
|
|
# Copyright 2012 Paul Gardner-Stephen
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
source "${0%/*}/../testconfig.sh"
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
setup_dna
|
2012-04-24 07:36:48 +00:00
|
|
|
assert_echo_works
|
2012-04-23 08:55:26 +00:00
|
|
|
compile_java_classes
|
2012-04-24 07:36:48 +00:00
|
|
|
setup_servald_so
|
2012-04-23 08:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
compile_java_classes() {
|
2012-04-24 07:36:48 +00:00
|
|
|
assert --message='Java compiler was detected by ./configure' [ "$JAVAC" ]
|
2012-04-23 08:55:26 +00:00
|
|
|
mkdir classes
|
2012-04-24 07:36:48 +00:00
|
|
|
assert $JAVAC -d classes "$dna_source_root"/java/org/servalproject/servald/*.java
|
2012-04-23 08:55:26 +00:00
|
|
|
assert [ -r classes/org/servalproject/servald/ServalD.class ]
|
2012-04-24 07:36:48 +00:00
|
|
|
assert [ -r classes/org/servalproject/servald/ServalDResult.class ]
|
|
|
|
assert [ -r classes/org/servalproject/servald/ServalDReentranceError.class ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make sure that the normal echo command-line works, without JNI.
|
|
|
|
assert_echo_works() {
|
|
|
|
executeOk $dna echo 'Hello,' 'world!'
|
|
|
|
assertStdoutIs -e 'Hello,\nworld!\n'
|
2012-04-23 08:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_Echo="Serval echo command works via JNI"
|
|
|
|
test_Echo() {
|
2012-04-24 07:36:48 +00:00
|
|
|
executeOk java -classpath "$PWD/classes" org.servalproject.servald.ServalD echo 'Hello,' 'world!'
|
2012-04-23 08:55:26 +00:00
|
|
|
assertStdoutIs -e 'Hello,\nworld!\n'
|
|
|
|
}
|
|
|
|
|
|
|
|
runTests "$@"
|
|
|
|
|