@@ -40,39 +40,51 @@ sys.exit(1)
4040' " ${1:- 0} "
4141}
4242
43+ # Find JAVA
44+ JAVABIN=$( " $TEST_SRCDIR " /google3/third_party/java/jdk/java_path )
45+ if [[ ! -f " $JAVABIN " ]]; then
46+ echo " Failed to locate java." ;
47+ exit 1
48+ fi
49+
4350# Find executable and shared libs
4451BINDIR=" $TEST_SRCDIR /google3/firebase/firestore/client/cpp"
4552FIRESTORE_EMULATOR_JAR=$BINDIR /CloudFirestore_emulator.jar
4653# Pick a random available port with timeout 0
4754EMULATOR_PORT=$( reserve_random_unused_tcp_port 0 )
4855
49- # Add java to PATH
50- JAVABIN=$( ls -d " $TEST_SRCDIR " /google3/third_party/java/jdk/jdk* -k8/bin | \
51- tail -1 )
52- PATH=$JAVABIN :$PATH
53-
5456# Start Firestore Emulator
55- echo " Running java -jar $FIRESTORE_EMULATOR_JAR --port=$EMULATOR_PORT "
56- java -jar " $FIRESTORE_EMULATOR_JAR " --port=" $EMULATOR_PORT " &
57+ echo " Running $JAVABIN -jar $FIRESTORE_EMULATOR_JAR --port=$EMULATOR_PORT "
58+ " $JAVABIN " -jar " $FIRESTORE_EMULATOR_JAR " --port=" $EMULATOR_PORT " &
5759EMULATOR_PID=$!
5860sleep 3
5961
6062# Running Android tests.
6163if [[ -f " $( ls " $BINDIR " /* _test_android_prod) " ]]; then
62- for test in $( ls " $BINDIR " /* _test_android_prod) ; do
63- " $test " --test_args=firestore_emulator_port=" $EMULATOR_PORT " || \
64- die " Test $test failed" $?
65- done
64+ for test in $( ls " $BINDIR " /* _test_android_prod) ; do
65+ " $test " --test_args=firestore_emulator_port=" $EMULATOR_PORT " || \
66+ die " Test $test failed" $?
67+ done
6668fi
6769
6870# Running iOS tests.
6971if [[ -f " $( ls " $BINDIR " /* _test_ios) " ]]; then
70- # Write Firestore Emulator address to a temp file
71- echo " localhost:$EMULATOR_PORT " > /tmp/emulator_address
72- for TEST in $( ls " $BINDIR " /* _test_ios) ; do
73- " $TEST " || die " Test $TEST failed" $?
74- done
75- rm /tmp/emulator_address
72+ # Write Firestore Emulator address to a temp file
73+ echo " localhost:$EMULATOR_PORT " > /tmp/emulator_address
74+ for TEST in $( ls " $BINDIR " /* _test_ios) ; do
75+ " $TEST " || die " Test $TEST failed" $?
76+ done
77+ rm /tmp/emulator_address
78+ fi
79+
80+ # Running Linux tests.
81+ if [[ -f " $( ls " $BINDIR " /* _test) " ]]; then
82+ # Write Firestore Emulator address to a temp file
83+ echo " localhost:$EMULATOR_PORT " > /tmp/emulator_address
84+ for TEST in $( ls " $BINDIR " /* _test) ; do
85+ " $TEST " || die " Test $TEST failed" $?
86+ done
87+ rm /tmp/emulator_address
7688fi
7789
7890kill $EMULATOR_PID
0 commit comments