-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathtest-jython.sh
More file actions
executable file
·67 lines (48 loc) · 1.67 KB
/
test-jython.sh
File metadata and controls
executable file
·67 lines (48 loc) · 1.67 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# test script for bin/jython
if [ -z "$1" ] ; then
echo "$0: usage: test-jython.sh <Jython home>" >&2
exit 99
fi
TEST_DIR="`mktemp -dt test-jython.XXXXXX`"
SPACE_DIR="$TEST_DIR/directory with spaces"
cp -Rp "$1" "$SPACE_DIR"
for JYTHON_HOME in "$SPACE_DIR" "$1" ; do
JYTHON="$JYTHON_HOME/bin/jython"
export JYTHON_HOME
set -ex
# -J passthrough
"$JYTHON" -J-version 2>&1 | [ `egrep -c "^java version "` == 1 ]
# Jython reports version
"$JYTHON" --version 2>&1 | [ `egrep -c "^Jython "` == 1 ]
# $JYTHON_OPTS
JYTHON_OPTS="--version" "$JYTHON" 2>&1 | [ `egrep -c "^Jython "` == 1 ]
# Jython help
"$JYTHON" --help 2>&1 | [ `egrep -c "^usage: "` == 1 ]
# Jython launcher help
"$JYTHON" --help 2>&1 | [ `egrep -c "^Jython launcher options:"` == 1 ]
# Jython exit status
set +e
"$JYTHON" -c 'import sys; sys.exit(5)'
[ $? == 5 ] || exit 1
set -e
# Jython executable (don't include newline in case it's \r\n)
[ `"$JYTHON" -c 'import sys; print sys.executable is not None,'` == True ]
# JDB
echo run | "$JYTHON" --jdb -c "print '\ntest'" | [ `egrep -c "^test"` == 1 ]
# Jython profiling
"$JYTHON" --profile -c pass 2>&1 | \
[ `egrep -c "^\| Thread depth limit:"` == 1 ]
[ -f profile.txt ] && rm profile.txt
# $CLASSPATH
CLASSPATH="$JYTHON_HOME/Lib/test/blob.jar" \
"$JYTHON" -c "print __import__('Blob')" | \
[ `egrep -c "Blob"` == 1 ]
# $CLASSPATH + profiling
CLASSPATH="$JYTHON_HOME/Lib/test/blob.jar" \
"$JYTHON" --profile -c "print __import__('Blob')" | \
[ `egrep -c "Blob"` == 1 ]
set +ex
done
rm -rf "$TEST_DIR"
echo "Test successful."