#!/bin/sh

. "$(dirname $0)/common.sh"

prepare
install_rspec

cd "$AUTOPKGTEST_TMP"

# extra java libs required
mkdir test/target
sudo ln -s /usr/share/java/junit4.jar test/target/junit.jar
sudo ln -s /usr/share/java/jakarta-annotation-api.jar test/target/annotation-api.jar
sudo ln -s /usr/share/java/jarjar.jar test/target/jarjar.jar

# compile a few test dependencies
gcc test/jruby/testapp/testapp.c -o test/jruby/testapp/testapp
javac -cp lib/jruby.jar:test/target/junit.jar:test/target/annotation-api.jar -d test/target/test-classes \
    test/org/jruby/test/*.java \
    test/org/jruby/javasupport/test/*.java \
    test/org/jruby/javasupport/test/*/*.java \
    test/Bug1621*.java

# some test cases look for these specific files
cp "$OLDPWD/pom.xml" .
sudo cp -a bin/jruby bin/jruby.sh

# run the rspec testsuite
jruby -S rake test:jruby
