diff --git a/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp b/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp index b9a24d8ec868d1c940dcdbe47e540a4918dc57cf..c5682d587ea8676ca1fd61d049e4bc9df65443ce 100644 --- a/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp +++ b/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp @@ -20,7 +20,8 @@ namespace maple { std::string Cpp2MplCompiler::GetBinPath(const MplOptions&) const{ - return FileUtils::SafeGetenv(kMapleRoot) + "/output/aarch64-clang-debug/bin/"; + return FileUtils::SafeGetenv(kMapleRoot) + "/output/" + + FileUtils::SafeGetenv("MAPLE_BUILD_TYPE") + "/bin/"; } const std::string &Cpp2MplCompiler::GetBinName() const { diff --git a/src/mapleall/maple_driver/src/maple_comb_compiler_wrapper.cpp b/src/mapleall/maple_driver/src/maple_comb_compiler_wrapper.cpp index a6dd51e6eb68b2b4b96a754ebbf473a88f39a341..a5b6cbdd69742ff6a9a7b427d17ea5b8414b1c26 100644 --- a/src/mapleall/maple_driver/src/maple_comb_compiler_wrapper.cpp +++ b/src/mapleall/maple_driver/src/maple_comb_compiler_wrapper.cpp @@ -27,7 +27,8 @@ const std::string &MapleCombCompilerWrp::GetBinName() const { } std::string MapleCombCompilerWrp::GetBinPath(const MplOptions&) const { - return FileUtils::SafeGetenv(kMapleRoot) + "/output/aarch64-clang-debug/bin/"; + return FileUtils::SafeGetenv(kMapleRoot) + "/output/" + + FileUtils::SafeGetenv("MAPLE_BUILD_TYPE") + "/bin/"; } DefaultOption MapleCombCompilerWrp::GetDefaultOptions(const MplOptions &mplOptions, diff --git a/testsuite/c_test/driver_test/DRIVER0001-helloworld/expected.txt b/testsuite/c_test/driver_test/DRIVER0001-helloworld/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b18e512dba79e4c8300dd08aeb37f8e728b8dad --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0001-helloworld/expected.txt @@ -0,0 +1 @@ +hello world diff --git a/testsuite/c_test/driver_test/DRIVER0001-helloworld/main.c b/testsuite/c_test/driver_test/DRIVER0001-helloworld/main.c new file mode 100644 index 0000000000000000000000000000000000000000..af155ecdba228bdf624dd06f45791f51f68c4f54 --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0001-helloworld/main.c @@ -0,0 +1,24 @@ +/* + * Copyright (C) [2020] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * 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 MulanPSL - 2.0 for more details. + */ + +#include +#include + +int main() +{ + printf("hello world\n"); + return 0; +} + diff --git a/testsuite/c_test/driver_test/DRIVER0001-helloworld/test.cfg b/testsuite/c_test/driver_test/DRIVER0001-helloworld/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4b14bced0b2417d53e317ba05bb6ae5c4d469a19 --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0001-helloworld/test.cfg @@ -0,0 +1,2 @@ +compile(main.c) +run(a) diff --git a/testsuite/c_test/driver_test/DRIVER0002-double/expected.txt b/testsuite/c_test/driver_test/DRIVER0002-double/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc31c08eeb94faff697db3e1cc7a002dac2aea01 --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0002-double/expected.txt @@ -0,0 +1,3 @@ +MAIN +HELPER +RES: 20 diff --git a/testsuite/c_test/driver_test/DRIVER0002-double/helper.c b/testsuite/c_test/driver_test/DRIVER0002-double/helper.c new file mode 100644 index 0000000000000000000000000000000000000000..fc93cf5279e8493febd434679f869708f261430c --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0002-double/helper.c @@ -0,0 +1,24 @@ +/* + * Copyright (C) [2020] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * 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 MulanPSL - 2.0 for more details. + */ + +#include +#include + +int helper(int in) +{ + printf("HELPER\n"); + return in * 2; +} + diff --git a/testsuite/c_test/driver_test/DRIVER0002-double/main.c b/testsuite/c_test/driver_test/DRIVER0002-double/main.c new file mode 100644 index 0000000000000000000000000000000000000000..213f1f36feec227ba1ae5f2b2cfefaba74449a20 --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0002-double/main.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) [2020] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * 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 MulanPSL - 2.0 for more details. + */ + +#include +#include + +int helper(int in); + +int main(void) +{ + printf("MAIN\n"); + int res = helper(10); + printf("RES: %d\n", res); + return 0; +} + diff --git a/testsuite/c_test/driver_test/DRIVER0002-double/test.cfg b/testsuite/c_test/driver_test/DRIVER0002-double/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6d9037301ba881f6a2394ac34eee56b1fa123b57 --- /dev/null +++ b/testsuite/c_test/driver_test/DRIVER0002-double/test.cfg @@ -0,0 +1,2 @@ +compile(main.c helper.c) +run(a) diff --git a/testsuite/driver/config/ci_testall.conf b/testsuite/driver/config/ci_testall.conf index 0e4af2e4f301b473fa5b92c2934ddd0d8997e8f1..6a5440a0460853bc48ed64241b9ba04235e72539 100755 --- a/testsuite/driver/config/ci_testall.conf +++ b/testsuite/driver/config/ci_testall.conf @@ -1,6 +1,7 @@ [MODE_SET] java_common_mode_set: O0, O2, GC_O0, GC_O2 c_common_mode_set: CO0, CO2 + c_driver_mode_set: DRIVER [DEFAULT_TEST_SUITE] c_test/ast_test: ASTO0, ASTO2 @@ -9,6 +10,7 @@ c_test/unit_test: c_common_mode_set c_test/super_test: SUPO0, SUPO2 c_test/supertestv2_test: SUPO0, SUPO2 + c_test/driver_test: c_driver_mode_set java_test/app_test: java_common_mode_set java_test/arrayboundary_test: java_common_mode_set java_test/clinit_test: java_common_mode_set diff --git a/testsuite/driver/config/testall.conf b/testsuite/driver/config/testall.conf index 5340f5c3eb300f09ce3f2bc3fb46d6224ca4e277..73a2ddd0608fca76ad51e08bda4a14a6437da842 100644 --- a/testsuite/driver/config/testall.conf +++ b/testsuite/driver/config/testall.conf @@ -1,6 +1,7 @@ [MODE_SET] java_common_mode_set: O0, O2 c_common_mode_set: CO0, CO2 + c_driver_mode_set: DRIVER [DEFAULT_TEST_SUITE] java_test/app_test: java_common_mode_set @@ -20,6 +21,7 @@ java_test/unsafe_test: java_common_mode_set irbuild_test: IR c_test/sanity_test: c_common_mode_set + c_test/driver_test: c_driver_mode_set [BAN_TEST_SUITE] irbuild_test/I0062-mapleall-irbuild-edge-pregs: IR diff --git a/testsuite/driver/config/testall_c.conf b/testsuite/driver/config/testall_c.conf index 36012990361a9ace3880989e7e4e6a842348e8d8..e9aac648deec0d224eda41967493b7b596684ca8 100755 --- a/testsuite/driver/config/testall_c.conf +++ b/testsuite/driver/config/testall_c.conf @@ -1,6 +1,7 @@ [MODE_SET] c_common_mode_set: CO0, CO2 spec_mode_set: SCO0_TEST, SCO2_TEST, SCO0_TRAIN, SCO2_TRAIN + c_driver_mode_set: DRIVER [DEFAULT_TEST_SUITE] c_test/spec_test: spec_mode_set @@ -9,6 +10,7 @@ c_test/gtorture_test: c_common_mode_set c_test/unit_test: c_common_mode_set c_test/super_test: SUPO0, SUPO2 + c_test/driver_test: c_driver_mode_set [BAN_TEST_SUITE] #clang compiler error diff --git a/testsuite/driver/src/api/driver.py b/testsuite/driver/src/api/driver.py new file mode 100644 index 0000000000000000000000000000000000000000..41b1dc476465b27d5ae3ab56e8f343e34c1711ee --- /dev/null +++ b/testsuite/driver/src/api/driver.py @@ -0,0 +1,31 @@ +# +# Copyright (c) [2021] 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. +# +# 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. +# + +from api.shell_operator import ShellOperator + + +class Driver(ShellOperator): + + def __init__(self, maple, global_option, inputs, return_value_list=None, redirection=None): + super().__init__(return_value_list, redirection) + self.maple = maple + self.global_option = global_option + self.inputs = inputs + + def get_command(self, variables): + self.command = self.maple + " " + self.command += self.global_option + " " + self.command += self.inputs + " " + + return super().get_final_command(variables) diff --git a/testsuite/driver/src/mode/DRIVER.py b/testsuite/driver/src/mode/DRIVER.py new file mode 100644 index 0000000000000000000000000000000000000000..027378a0e908ce003b9ebd9083059a07fc8448f2 --- /dev/null +++ b/testsuite/driver/src/mode/DRIVER.py @@ -0,0 +1,34 @@ +# +# Copyright (c) [2021] 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. +# +# 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. +# + +from api import * + +DRIVER = { + "compile": [ + Driver( + maple="${OUT_ROOT}/${MAPLE_BUILD_TYPE}/bin/maple", + global_option="-c", + inputs="${APP}" + ) + ], + "run": [ + Shell( + "${OUT_ROOT}/tools/bin/qemu-aarch64 -L ${OUT_ROOT}/tools/gcc-linaro-7.5.0/aarch64-linux-gnu/libc ${APP}.out > output.log 2>&1" + ), + CheckFileEqual( + file1="output.log", + file2="expected.txt" + ) + ] +}