blob: 8ce44a9f9b3e9e3ec4c4a7c3634c0548c4494f56 [file] [log] [blame]
#!/bin/sh
#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARGS=${@}
BRIDGE_SO=libnativebridgetestd.so
if echo ${ARGS} | grep -q " -O"; then
BRIDGE_SO=libnativebridgetest.so
fi
# Use libnativebridgetest as a native bridge, start NativeBridgeMain (Main is JniTest main file).
LIBPATH=$(echo ${ARGS} | sed -r 's/.*Djava.library.path=([^ ]*) .*/\1/')
# Trim all but the last entry in LIBPATH, which will be nativetest[64]
LIBPATH=${LIBPATH##*:}
ln -sf ${LIBPATH}/$BRIDGE_SO .
touch libarttest.so
touch libarttestd.so
touch libinvalid.so
ln -sf ${LIBPATH}/libarttest.so libarttest2.so
ln -sf ${LIBPATH}/libarttestd.so libarttestd2.so
# pwd likely has /, so it's a pain to put that into a sed rule.
LEFT=$(echo ${ARGS} | sed -r 's/-Djava.library.path.*//')
RIGHT=$(echo ${ARGS} | sed -r 's/.*Djava.library.path[^ ]* //')
MODARGS="${LEFT} -Djava.library.path=`pwd` ${RIGHT}"
exec ${RUN} --runtime-option -Xforce-nb-testing --runtime-option -XX:NativeBridge=$BRIDGE_SO ${MODARGS} NativeBridgeMain