-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "ojluni: Downstream OJ tests""
This reverts commit 6b74f41. Change-Id: I06fd28baa6e4793b3e3d3639745a3a68f89b2582
- Loading branch information
Showing
89 changed files
with
16,270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (C) 2016 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. | ||
|
||
|
||
|
||
### | ||
### Change the BOOTCLASSPATH to pick up bootlib classes. | ||
### Export ANDROID_DATA=something else (it should have dalvik-cache dir in it) | ||
### Point the image to something else that's not existing. | ||
### | ||
### Actually run dalvikvm now... | ||
### | ||
|
||
if [[ -z $ANDROID_BUILD_TOP ]]; then | ||
echo "Run source build/envsetup.sh first" >& 2 | ||
exit 1 | ||
fi | ||
|
||
invoke_with= | ||
DALVIKVM=dalvikvm | ||
LIBART=libart.so | ||
|
||
function follow_links() { | ||
if [ z"$BASH_SOURCE" != z ]; then | ||
file="$BASH_SOURCE" | ||
else | ||
file="$0" | ||
fi | ||
while [ -h "$file" ]; do | ||
# On Mac OS, readlink -f doesn't work. | ||
file="$(readlink "$file")" | ||
done | ||
echo "$file" | ||
} | ||
|
||
function find_libdir() { | ||
# Use realpath instead of readlink because Android does not have a readlink. | ||
if [ "$(realpath "$ANDROID_ROOT/bin/$DALVIKVM")" = "$(realpath "$ANDROID_ROOT/bin/dalvikvm64")" ]; then | ||
echo "lib64" | ||
else | ||
echo "lib" | ||
fi | ||
} | ||
|
||
function join { local IFS="$1"; shift; echo "$*"; } | ||
|
||
PROG_NAME="$(follow_links)" | ||
PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | ||
|
||
if [[ -z $ANDROID_ROOT ]]; then | ||
# Already set to /system for actual android devices | ||
ANDROID_ROOT=$ANDROID_HOST_OUT | ||
fi | ||
LIBDIR=$(find_libdir) | ||
LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBDIR | ||
DEBUG_OPTION="" | ||
|
||
|
||
DELETE_ANDROID_DATA=false | ||
# If ANDROID_DATA is the system ANDROID_DATA or is not set, use our own, | ||
# and ensure we delete it at the end. | ||
if [ "$ANDROID_DATA" = "/data" ] || [ "$ANDROID_DATA" = "" ]; then | ||
ANDROID_DATA=$PWD/android-data$$ | ||
IMAGE_DIRECTORY=$ANDROID_DATA/image | ||
mkdir -p $ANDROID_DATA/dalvik-cache/{arm,arm64,x86,x86_64} | ||
mkdir -p $IMAGE_DIRECTORY | ||
DELETE_ANDROID_DATA=true | ||
fi | ||
|
||
|
||
IMAGE_LOCATION=$IMAGE_DIRECTORY/core-extrabootclasspath.art | ||
|
||
BOOT_DEXJARS=( | ||
bouncycastle-hostdex.jar | ||
apache-xml-hostdex.jar | ||
core-tests-hostdex.jar | ||
core-libart-hostdex.jar | ||
core-lambda-stubs-hostdex.jar | ||
conscrypt-hostdex.jar | ||
core-ojtests-hostdex.jar | ||
core-oj-hostdex.jar | ||
okhttp-hostdex.jar) | ||
|
||
BOOT_DEXJAR_PREFIX="$ANDROID_ROOT/framework" | ||
|
||
BOOT_DEXJARS_ABS=() | ||
for dexjar in ${BOOT_DEXJARS[@]}; do | ||
BOOT_DEXJARS_ABS=(${BOOT_DEXJARS_ABS[@]} $BOOT_DEXJAR_PREFIX/$dexjar) | ||
done | ||
|
||
export BOOTCLASSPATH=$(join ":" "${BOOT_DEXJARS_ABS[@]}") # a,b,c | ||
|
||
echo "BOOTCLASSPATH=$BOOTCLASSPATH" | ||
echo "PROG_NAME=$PROG_NAME" | ||
echo "PROG_DIR=$PROG_DIR" | ||
echo "ANDROID_ROOT=$ANDROID_ROOT" | ||
echo "LIBDIR=$LIBDIR" | ||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" | ||
echo "DEBUG_OPTION=$DEBUG_OPTION" | ||
|
||
echo "export BOOTCLASSPATH=$BOOTCLASSPATH" | ||
echo export ANDROID_ROOT="$ANDROID_ROOT" | ||
ANDROID_DATA=$ANDROID_DATA \ | ||
ANDROID_ROOT=$ANDROID_ROOT \ | ||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \ | ||
PATH=$ANDROID_ROOT/bin:$PATH \ | ||
LD_USE_LOAD_BIAS=1 \ | ||
$invoke_with $ANDROID_ROOT/bin/$DALVIKVM $lib \ | ||
-XXlib:$LIBART \ | ||
-Xnorelocate \ | ||
-Ximage:$IMAGE_LOCATION \ | ||
$DEBUG_OPTION \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (C) 2016 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. | ||
|
||
./artrun org.testng.TestNG -verbose 3 ./testng.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (C) 2016 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. | ||
|
||
### | ||
### Scan this directory for any testng classes | ||
### Outputs a testng.xml formatted list of classes | ||
### | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
test_property_files="$(find "$DIR" -name TEST.properties)" | ||
|
||
function debug_print { | ||
if [[ $DEBUG == "true" ]]; then | ||
echo "DEBUG:" "$@" >& 2 | ||
fi | ||
} | ||
|
||
function error_print { | ||
echo "ERROR:" "$@" >& 2 | ||
exit 1 | ||
} | ||
|
||
function class_name_from_class_file { | ||
# Reads a list of .java files from stdin, spits out their fully qualified class name. | ||
local file_name | ||
local package_string | ||
local package_name | ||
local class_name | ||
while read file_name; do | ||
package_string="$(grep "package" "$file_name")" | ||
[[ $? -ne 0 ]] && error_print "File $file_name missing package declaration." | ||
debug_print "File: $file_name" | ||
|
||
# Parse the package name by looking inside of the file. | ||
package_name=${package_string#package[[:space:]]*} # remove package followed by any spaces | ||
package_name=${package_name%;} # remove semicolon at the end | ||
|
||
# Assumes class name == file name. Almost always the case. | ||
class_name="$(basename "$file_name")" | ||
class_name="${class_name%.java}" # remove ".java" from the end | ||
debug_print "Package: <$package_name>" | ||
|
||
echo "$package_name.$class_name" | ||
done | ||
} | ||
|
||
function list_classes_in_dir { | ||
find "$1" -name "*.java" | class_name_from_class_file | ||
} | ||
|
||
function list_all_classes { | ||
local file | ||
for file in $test_property_files; do | ||
debug_print "File: $file" | ||
|
||
if ! grep "TestNG.dirs" "$file" > /dev/null; then | ||
continue | ||
fi | ||
|
||
debug_print "Has TestNG files" | ||
|
||
list_classes_in_dir "$(dirname "$file")" | ||
done | ||
} | ||
|
||
function class_name_to_testng_entry { | ||
local class_name | ||
while read class_name; do | ||
echo "<class name=\"$class_name\" />" | ||
done | ||
} | ||
|
||
list_all_classes | class_name_to_testng_entry |
Oops, something went wrong.