From a73ab25e0851875ad4bdd2827882fdafa2283883 Mon Sep 17 00:00:00 2001 From: Panferov Ivan Date: Tue, 12 Dec 2023 19:03:38 +0300 Subject: [PATCH] Fix YZ CodeCheck Description: Fix YZ CodeCheck Issue: #I8NVTO Testing: Build Change-Id: Iccc7cebe1aa5d87b4c229aa89c7f9e4adb84206b Signed-off-by: Panferov Ivan --- ets2panda/linter-4.2/README.md | 2 +- ets2panda/linter-4.2/test_linter.sh | 3 +++ .../linter-4.2/{tslinter.cmd => tslinter.bat} | 0 ets2panda/linter-4.2/tslinter.sh | 2 +- ets2panda/linter/README.md | 2 +- ets2panda/linter/test_linter.sh | 3 +++ ets2panda/linter/{tslinter.cmd => tslinter.bat} | 0 ets2panda/linter/tslinter.sh | 2 +- ets2panda/scripts/es2panda_coverage.sh | 2 ++ ets2panda/scripts/test_runner.py | 3 ++- ets2panda/test/tsconfig/test.sh | 4 ++-- ets2panda/util/declgenEts2Ts.cpp | 16 ++++++++++++++++ test262/config.py | 8 ++++---- test262/run_test262.py | 8 ++++---- 14 files changed, 40 insertions(+), 15 deletions(-) rename ets2panda/linter-4.2/{tslinter.cmd => tslinter.bat} (100%) rename ets2panda/linter/{tslinter.cmd => tslinter.bat} (100%) diff --git a/ets2panda/linter-4.2/README.md b/ets2panda/linter-4.2/README.md index 3983b1f551..b73e779ba7 100644 --- a/ets2panda/linter-4.2/README.md +++ b/ets2panda/linter-4.2/README.md @@ -33,7 +33,7 @@ node dist/tslinter.js [options] [input files] Note: Before linting a project, it is highly recommended to install all project dependencies (with `npm install` or any other methods -- depends on the concrete project). -You can also use command files `tslinter.sh` or `tslinter.cmd` with same arguments as for direct launch. +You can also use command files `tslinter.sh` or `tslinter.bat` with same arguments as for direct launch. Possible command options: diff --git a/ets2panda/linter-4.2/test_linter.sh b/ets2panda/linter-4.2/test_linter.sh index 414a1d798f..a0a846dcb1 100644 --- a/ets2panda/linter-4.2/test_linter.sh +++ b/ets2panda/linter-4.2/test_linter.sh @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +set -e + echo echo "=======================" echo "test linter in IDE mode" diff --git a/ets2panda/linter-4.2/tslinter.cmd b/ets2panda/linter-4.2/tslinter.bat similarity index 100% rename from ets2panda/linter-4.2/tslinter.cmd rename to ets2panda/linter-4.2/tslinter.bat diff --git a/ets2panda/linter-4.2/tslinter.sh b/ets2panda/linter-4.2/tslinter.sh index f0e3712962..d045f942cf 100644 --- a/ets2panda/linter-4.2/tslinter.sh +++ b/ets2panda/linter-4.2/tslinter.sh @@ -16,7 +16,7 @@ # # get absolute path to linter folder for possible use in future -TSLINTER_HOME_PATH=`cd $(dirname $0) && pwd` +TSLINTER_HOME_PATH=$(cd $(dirname $0) && pwd) # use relative path due to node.js error under cygwin environment node $(dirname $0)/./dist/tslinter.js $@ diff --git a/ets2panda/linter/README.md b/ets2panda/linter/README.md index 3983b1f551..b73e779ba7 100644 --- a/ets2panda/linter/README.md +++ b/ets2panda/linter/README.md @@ -33,7 +33,7 @@ node dist/tslinter.js [options] [input files] Note: Before linting a project, it is highly recommended to install all project dependencies (with `npm install` or any other methods -- depends on the concrete project). -You can also use command files `tslinter.sh` or `tslinter.cmd` with same arguments as for direct launch. +You can also use command files `tslinter.sh` or `tslinter.bat` with same arguments as for direct launch. Possible command options: diff --git a/ets2panda/linter/test_linter.sh b/ets2panda/linter/test_linter.sh index 414a1d798f..a0a846dcb1 100644 --- a/ets2panda/linter/test_linter.sh +++ b/ets2panda/linter/test_linter.sh @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +set -e + echo echo "=======================" echo "test linter in IDE mode" diff --git a/ets2panda/linter/tslinter.cmd b/ets2panda/linter/tslinter.bat similarity index 100% rename from ets2panda/linter/tslinter.cmd rename to ets2panda/linter/tslinter.bat diff --git a/ets2panda/linter/tslinter.sh b/ets2panda/linter/tslinter.sh index f0e3712962..d045f942cf 100644 --- a/ets2panda/linter/tslinter.sh +++ b/ets2panda/linter/tslinter.sh @@ -16,7 +16,7 @@ # # get absolute path to linter folder for possible use in future -TSLINTER_HOME_PATH=`cd $(dirname $0) && pwd` +TSLINTER_HOME_PATH=$(cd $(dirname $0) && pwd) # use relative path due to node.js error under cygwin environment node $(dirname $0)/./dist/tslinter.js $@ diff --git a/ets2panda/scripts/es2panda_coverage.sh b/ets2panda/scripts/es2panda_coverage.sh index a299f1c515..f6a2ed89d1 100644 --- a/ets2panda/scripts/es2panda_coverage.sh +++ b/ets2panda/scripts/es2panda_coverage.sh @@ -14,6 +14,8 @@ # Huawei Technologies Co.,Ltd. +set -e + for ARGUMENT in "$@" do case "$ARGUMENT" in diff --git a/ets2panda/scripts/test_runner.py b/ets2panda/scripts/test_runner.py index e759dddc02..7250909885 100644 --- a/ets2panda/scripts/test_runner.py +++ b/ets2panda/scripts/test_runner.py @@ -1,4 +1,5 @@ -#/usr/bin/env python +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- # Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/ets2panda/test/tsconfig/test.sh b/ets2panda/test/tsconfig/test.sh index 6404a6cdeb..81531e485a 100755 --- a/ets2panda/test/tsconfig/test.sh +++ b/ets2panda/test/tsconfig/test.sh @@ -17,7 +17,7 @@ set -e SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" usage() { - echo "Usage: $0 /path/to/panda/build/bin/es2panda /path/to/tsproject [PANDA_RUN_PREFIX]" + echo "Usage: $0 path/to/panda/build/bin/es2panda path/to/tsproject [PANDA_RUN_PREFIX]" } ensure_exists() { @@ -40,7 +40,7 @@ ensure_exists "$TSCONFIG" ensure_exists "$ES2PANDA" ensure_exists "$EXPECTED" -rm -rf "$BUILD" +rm -r -f "$BUILD" ACTUAL=$(mktemp /tmp/actual.XXXXXX) STDLIB="$PANDA_ROOT/plugins/ets/stdlib" diff --git a/ets2panda/util/declgenEts2Ts.cpp b/ets2panda/util/declgenEts2Ts.cpp index a1f2c4d90e..d291d11696 100644 --- a/ets2panda/util/declgenEts2Ts.cpp +++ b/ets2panda/util/declgenEts2Ts.cpp @@ -49,6 +49,22 @@ static void Warning(const std::string &msg) void TSDeclGen::Generate() { + std::stringstream license; + license << "/*\n"; + license << " * Copyright (c) 2023 Huawei Device Co., Ltd.\n"; + license << " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"; + license << " * you may not use this file except in compliance with the License.\n"; + license << " * You may obtain a copy of the License at\n"; + license << " *\n"; + license << " * http://www.apache.org/licenses/LICENSE-2.0\n"; + license << " *\n"; + license << " * Unless required by applicable law or agreed to in writing, software\n"; + license << " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"; + license << " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"; + license << " * See the License for the specific language governing permissions and\n"; + license << " * limitations under the License.\n"; + license << " */\n\n"; + Out(license.str()); Out("declare const exports: any;"); OutEndl(2); diff --git a/test262/config.py b/test262/config.py index 44501352a0..066c633679 100755 --- a/test262/config.py +++ b/test262/config.py @@ -48,10 +48,10 @@ RK3568_PRODUCT_NAME = "rk3568" DEFAULT_PRODUCT_NAME = HISPARK_TAURUS_PRODUCT_NAME ARGS_PREFIX = f"{CODE_ROOT}/out/" -ARK_DIR_SUFFIX = "/clang_x64/arkcompiler/ets_frontend" -ICUI_DIR_SUFFIX = "/clang_x64/thirdparty/icu" -ARK_JS_RUNTIME_DIR_SUFFIX = "/clang_x64/arkcompiler/ets_runtime" -ZLIB_DIR_SUFFIX = "/clang_x64/thirdparty/zlib" +ARK_DIR_SUFFIX = "clang_x64/arkcompiler/ets_frontend" +ICUI_DIR_SUFFIX = "clang_x64/thirdparty/icu" +ARK_JS_RUNTIME_DIR_SUFFIX = "clang_x64/arkcompiler/ets_runtime" +ZLIB_DIR_SUFFIX = "clang_x64/thirdparty/zlib" DEFAULT_ARK_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/arkcompiler/ets_frontend" DEFAULT_ICUI_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/thirdparty/icu" diff --git a/test262/run_test262.py b/test262/run_test262.py index 97dd0dbf57..6eae1f22d6 100755 --- a/test262/run_test262.py +++ b/test262/run_test262.py @@ -571,10 +571,10 @@ def get_host_args(args, host_type): if args.product_name: product_name = args.product_name - ark_dir = f"{ARGS_PREFIX}{product_name}{ARK_DIR_SUFFIX}" - icui_dir = f"{ARGS_PREFIX}{product_name}{ICUI_DIR_SUFFIX}" - ark_js_runtime_dir = f"{ARGS_PREFIX}{product_name}{ARK_JS_RUNTIME_DIR_SUFFIX}" - zlib_dir = f"{ARGS_PREFIX}{product_name}{ZLIB_DIR_SUFFIX}" + ark_dir = f"{ARGS_PREFIX}{product_name}/{ARK_DIR_SUFFIX}" + icui_dir = f"{ARGS_PREFIX}{product_name}/{ICUI_DIR_SUFFIX}" + ark_js_runtime_dir = f"{ARGS_PREFIX}{product_name}/{ARK_JS_RUNTIME_DIR_SUFFIX}" + zlib_dir = f"{ARGS_PREFIX}{product_name}/{ZLIB_DIR_SUFFIX}" ark_tool = os.path.join(ark_js_runtime_dir, "ark_js_vm") libs_dir = f"{icui_dir}:{LLVM_DIR}:{ark_js_runtime_dir}:{zlib_dir}" -- Gitee