Blame tests/p_java-1.6.0-openjdk/10-test_java.sh

Christoph Galuschka e2cd20
#!/bin/sh
Christoph Galuschka e2cd20
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka e2cd20
23d4a0
if (t_GetArch | grep -qE 'aarch64|armv7hl|ppc64le')
07966e
  then
9a1e76
  echo "Package not included for current arch, skipping"
07966e
  exit 0
07966e
fi
07966e
Christoph Galuschka e2cd20
t_Log "Running $0 - javac can compile and java can print 'hello centos'"
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
# creating source file
Christoph Galuschka e2cd20
PATH2FILE='/var/tmp/'
Christoph Galuschka e2cd20
FILE='HelloWorld'
Christoph Galuschka e2cd20
FILE2=$PATH2FILE$FILE.java
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
cat > $FILE2 <
Christoph Galuschka e2cd20
public class HelloWorld {
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
  public static void main(String[] args) {
Christoph Galuschka e2cd20
    System.out.println("hello centos");
Christoph Galuschka e2cd20
  }
Christoph Galuschka e2cd20
}
Christoph Galuschka e2cd20
EOF
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
# Compiling
Christoph Galuschka e2cd20
javac $FILE2
Christoph Galuschka e2cd20
if [ $? == 1 ]
Christoph Galuschka e2cd20
  then
Christoph Galuschka e2cd20
  t_Log "Java-Compilation failed"
Christoph Galuschka e2cd20
  exit
Christoph Galuschka e2cd20
fi
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
# executing java
Christoph Galuschka e2cd20
workpath=$(pwd)
Christoph Galuschka e2cd20
cd $PATH2FILE
Christoph Galuschka d315fb
java $FILE |grep -q 'hello centos'
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
t_CheckExitStatus $?
Christoph Galuschka e2cd20
Christoph Galuschka e2cd20
cd $workpath
Christoph Galuschka e2cd20
# remove files
Christoph Galuschka e2cd20
/bin/rm $PATH2FILE$FILE.class $FILE2