diff --git a/build/envsetup.sh b/build/envsetup.sh index 25e438e8f53a30b98e197d02ea4e8bde88c7cd9f..413a50e799bd1a013518011af32b6584a6ca18de 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -26,13 +26,11 @@ if [ "$#" -lt 2 ]; then fi curdir=$(pwd) -unset MAPLE_ROOT export MAPLE_ROOT=${curdir} -unset ANDROID_ROOT +export CASE_ROOT=${curdir}/testsuite +export OUT_ROOT=${curdir}/output export ANDROID_ROOT=${curdir}/android -unset MAPLE_BUILD_CORE export MAPLE_BUILD_CORE=${MAPLE_ROOT}/build/core -unset IS_AST2MPL_EXISTS if [ -d ${MAPLE_ROOT}/src/ast2mpl ]; then export IS_AST2MPL_EXISTS=1 else @@ -54,15 +52,10 @@ export OLD_OS=${OLD_OS} # workaround for current build if [ "$#" -eq 0 ]; then -unset MAPLE_BUILD_OUTPUT -export MAPLE_BUILD_OUTPUT=${MAPLE_ROOT}/output - -unset MAPLE_EXECUTE_BIN -export MAPLE_EXECUTE_BIN=${MAPLE_ROOT}/output/bin - -unset MAPLE_DEBUG -export MAPLE_DEBUG=0 -return + export MAPLE_BUILD_OUTPUT=${MAPLE_ROOT}/output + export MAPLE_EXECUTE_BIN=${MAPLE_ROOT}/output/bin + export MAPLE_DEBUG=0 + return fi # support multiple ARCH and BUILD_TYPE @@ -98,32 +91,17 @@ else return fi -unset MAPLE_DEBUG export MAPLE_DEBUG=${DEBUG} - -unset TARGET_PROCESSOR export TARGET_PROCESSOR=${PLATFORM} - -unset TARGET_SCOPE export TARGET_SCOPE=${TYPE} - -unset USE_OJ_LIBCORE export USE_OJ_LIBCORE=${USEOJ} - -unset TARGET_TOOLCHAIN export TARGET_TOOLCHAIN=clang - -unset MAPLE_BUILD_TYPE export MAPLE_BUILD_TYPE=${TARGET_PROCESSOR}-${TARGET_TOOLCHAIN}-${TARGET_SCOPE} echo "Build: $MAPLE_BUILD_TYPE" - -unset MAPLE_BUILD_OUTPUT export MAPLE_BUILD_OUTPUT=${MAPLE_ROOT}/output/${MAPLE_BUILD_TYPE} - -unset MAPLE_EXECUTE_BIN export MAPLE_EXECUTE_BIN=${MAPLE_ROOT}/output/${MAPLE_BUILD_TYPE}/bin - -export PATH=$PATH:${MAPLE_EXECUTE_BIN} +export TEST_BIN=${CASE_ROOT}/driver/script +export PATH=$PATH:${MAPLE_EXECUTE_BIN}:${TEST_BIN} if [ ! -f $MAPLE_ROOT/tools/qemu/package/usr/bin/qemu-aarch64 ] && [ "$OLD_OS" = "0" ]; then echo " " diff --git a/build/java2dex b/build/java2dex new file mode 100755 index 0000000000000000000000000000000000000000..33e4ad61a130015e206599baf8f412c8eed955bb --- /dev/null +++ b/build/java2dex @@ -0,0 +1,92 @@ +# +# Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. +# +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# +# http://license.coscl.org.cn/MulanPSL2 +# +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR +# FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +#!/bin/bash +set -e +#set -x +# compile a .java to .dex using javac/dx tool chain. +# using: java2dex.sh xxx.java +# output: xxx.dex + +while getopts 'i:o:p:s:' args; +do + case ${args} in + i) INPUT_FILE=${OPTARG};; + p) CLASSES_JAR_FILE=${OPTARG};; + o) OUT_FILE=${OPTARG};; + s) USE_SIMPLEJAVA=${OPTARG};; + *) echo "invaild param:"${OPTARG};; + esac +done + +CASEDIR=$(pwd) +DESTDIR=$(pwd)/java2dex +mkdir -p ${DESTDIR} +JAVA_FILE=${INPUT_FILE//:/' '} +CLASS_FILE_ALL=${JAVA_FILE//\.java/\.class} +CLASS_FILE=*.class +JAR_FILE=`echo ${OUT_FILE} |awk -F. '{print $1}'`".jar" +CLASS_PATH='--classpath '${CLASSES_JAR_FILE//:/' --classpath '} + +java_file_exist=0 +for i in ${JAVA_FILE} +do + if [ -f $i ];then + java_file_exist=1 + break + fi +done + +if [ ${java_file_exist} -eq 1 ];then + javac -g -d ${DESTDIR} -bootclasspath ${CLASSES_JAR_FILE} ${JAVA_FILE} +fi + +mkdir -p ${DESTDIR}/classes +cd ${DESTDIR}/classes + +if [ -z ${USE_SIMPLEJAVA} ];then + find ${DESTDIR} -name "*.class" | xargs -i cp {} ${DESTDIR}/classes +else + find ${DESTDIR} -name ${CLASS_FILE_ALL} | xargs -i cp {} ${DESTDIR}/classes +fi + +class_file_exist=0 +for i in ${CLASS_FILE_ALL} +do + x=`basename $i` + if [ -f ${DESTDIR}/classes/$x ];then + class_file_exist=1 + cp ${DESTDIR}/classes/*.class ${CASEDIR} + break + fi +done + +if [ ${class_file_exist} -eq 1 ];then + jar -cvf $DESTDIR/${JAR_FILE} ${CLASS_FILE} +fi + +if [ -f ${DESTDIR}/${JAR_FILE} ];then + java -Xmx1024M -jar ${MAPLE_ROOT}/third_party/d8/lib/d8.jar --min-api 39 --output ${DESTDIR} ${DESTDIR}/${JAR_FILE} ${CLASS_PATH} +fi + +if [ -f ${DESTDIR}/classes.dex ];then + cp ${DESTDIR}/classes.dex ${CASEDIR}/${OUT_FILE} +fi + +if [ -f ${DESTDIR}/*.jar ];then + cp ${DESTDIR}/*.jar ${CASEDIR} +fi + +rm -rf ${DESTDIR} + diff --git a/testsuite/driver/src/__pycache__/case.cpython-35.pyc b/testsuite/driver/src/__pycache__/case.cpython-35.pyc deleted file mode 100644 index b21231756a03f5b9a3ada79583dff43407fc1be8..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/case.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/env_var.cpython-35.pyc b/testsuite/driver/src/__pycache__/env_var.cpython-35.pyc deleted file mode 100644 index ec2e172e059f2f6e894ae9c7f3b7b11d11519715..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/env_var.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/mod_table.cpython-35.pyc b/testsuite/driver/src/__pycache__/mod_table.cpython-35.pyc deleted file mode 100644 index 0029e8c6b76a8ac209c90293532dfd363e3cfdc6..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/mod_table.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/shell_executor.cpython-35.pyc b/testsuite/driver/src/__pycache__/shell_executor.cpython-35.pyc deleted file mode 100644 index 0e5fc574141d052ea12f6221cac3d4e08b324c4f..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/shell_executor.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/target.cpython-35.pyc b/testsuite/driver/src/__pycache__/target.cpython-35.pyc deleted file mode 100644 index 9b19455b0c40af1dee0018b51a47589b9ef714ce..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/target.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/task.cpython-35.pyc b/testsuite/driver/src/__pycache__/task.cpython-35.pyc deleted file mode 100644 index f735fee50e1fcb4fd987769af958a5d606f9365a..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/task.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/__pycache__/test_cfg.cpython-35.pyc b/testsuite/driver/src/__pycache__/test_cfg.cpython-35.pyc deleted file mode 100644 index a05d749173631e694a9a01d87aa7e50d2af76f60..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/__pycache__/test_cfg.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/__init__.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index 8663fa20b1fec4c6d18ea2383b64f50ce497c57e..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/__init__.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/check_file_equal.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/check_file_equal.cpython-35.pyc deleted file mode 100644 index c2856856e95aba4344e32fe273c59b1a46ff1529..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/check_file_equal.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/dex2mpl.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/dex2mpl.cpython-35.pyc deleted file mode 100644 index 570a917163a80273e57465c313dfad541a7e4fad..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/dex2mpl.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/irbuild.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/irbuild.cpython-35.pyc deleted file mode 100644 index 771679250c5bdf25d0fdd742fed14590aa92a0c2..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/irbuild.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/java2dex.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/java2dex.cpython-35.pyc deleted file mode 100644 index 19013382ea8940abc81bbb65baad87361ffcf202..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/java2dex.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/linker.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/linker.cpython-35.pyc deleted file mode 100644 index e2710b51e7a49066ba41865afe288f2ec5c35db8..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/linker.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/maple.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/maple.cpython-35.pyc deleted file mode 100644 index 8b8cc5bed029877385d56e9fd07af4c00094d87e..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/maple.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/mplsh.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/mplsh.cpython-35.pyc deleted file mode 100644 index e06f689af941ff0d5a8e8a29318471f3f8ca539b..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/mplsh.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/shell.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/shell.cpython-35.pyc deleted file mode 100644 index a95f35a949103d34d00161be8daa572aa6f79dcd..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/shell.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/__pycache__/shell_operator.cpython-35.pyc b/testsuite/driver/src/api/__pycache__/shell_operator.cpython-35.pyc deleted file mode 100644 index c9e12ff01309251906e5eaf2b2db0f6cc692a220..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/api/__pycache__/shell_operator.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/api/java2dex.py b/testsuite/driver/src/api/java2dex.py index 3dc5412ad4731d225ed9b651290238de2c556fe4..fe7f703b06eda565517de98140575f0b8f017f2f 100644 --- a/testsuite/driver/src/api/java2dex.py +++ b/testsuite/driver/src/api/java2dex.py @@ -24,5 +24,5 @@ class Java2dex(ShellOperator): self.infile = infile def get_command(self, variables): - self.command = "${OUT_ROOT}/aarch64-clang-release/bin/java2dex -o " + self.outfile + " -p " + ":".join(self.jar_file) + " -i " + ":".join(self.infile) + self.command = "${MAPLE_ROOT}/build/java2dex -o " + self.outfile + " -p " + ":".join(self.jar_file) + " -i " + ":".join(self.infile) return super().get_final_command(variables) diff --git a/testsuite/driver/src/basic_tools/__pycache__/__init__.cpython-35.pyc b/testsuite/driver/src/basic_tools/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index db3d2ce02800906fde681dabc8047cd79d3bbaa1..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/basic_tools/__pycache__/__init__.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/basic_tools/__pycache__/file.cpython-35.pyc b/testsuite/driver/src/basic_tools/__pycache__/file.cpython-35.pyc deleted file mode 100644 index e6fde33a49e51efc9162db2e0efc6be979c234f2..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/basic_tools/__pycache__/file.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/basic_tools/__pycache__/string.cpython-35.pyc b/testsuite/driver/src/basic_tools/__pycache__/string.cpython-35.pyc deleted file mode 100644 index 5df6c3b4ae8ede4205ba3666559b1c0067462e52..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/basic_tools/__pycache__/string.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/basic_tools/__pycache__/string_list.cpython-35.pyc b/testsuite/driver/src/basic_tools/__pycache__/string_list.cpython-35.pyc deleted file mode 100644 index 3f35b97745d9f2a6410c6c3173d1ae7c9df53f70..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/basic_tools/__pycache__/string_list.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/mod/O0.py b/testsuite/driver/src/mod/O0.py index 6cd43dcff0060a66c15bf3db7ffc9bc928b418ee..0cc39ed249f1fcdbca8eaed51c1f2a257c2d11ee 100644 --- a/testsuite/driver/src/mod/O0.py +++ b/testsuite/driver/src/mod/O0.py @@ -17,7 +17,7 @@ from api import * O0 = { "clean": [ Shell( - "rm -rf *.mpl *.dex *.class *.mplt *.s *.so *.o *.log *.jar" + "rm -rf *.mpl *.dex *.class *.mplt *.s *.so *.o *.log *.jar *.VtableImpl.primordials.txt" ) ], "compile": [ diff --git a/testsuite/driver/src/mod/__pycache__/IR.cpython-35.pyc b/testsuite/driver/src/mod/__pycache__/IR.cpython-35.pyc deleted file mode 100644 index eaec7124a87cac5bca08788287f6d34dde377e2c..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/mod/__pycache__/IR.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/mod/__pycache__/O0.cpython-35.pyc b/testsuite/driver/src/mod/__pycache__/O0.cpython-35.pyc deleted file mode 100644 index 587283e7b69521dfca7737f9557de8c14b0920c4..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/mod/__pycache__/O0.cpython-35.pyc and /dev/null differ diff --git a/testsuite/driver/src/mod/__pycache__/__init__.cpython-35.pyc b/testsuite/driver/src/mod/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index 07fa443c291699471c1a5d25dc23fefd869d7e9c..0000000000000000000000000000000000000000 Binary files a/testsuite/driver/src/mod/__pycache__/__init__.cpython-35.pyc and /dev/null differ