diff --git a/test262/copy_gcda.sh b/test262/copy_gcda.sh new file mode 100644 index 0000000000000000000000000000000000000000..bead95b55a863c4c63cb0463afd195774d17e7b6 --- /dev/null +++ b/test262/copy_gcda.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# 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. +SCRIPT_DIR=$(cd $(dirname $0);pwd) + +if [ $# -eq 0 ]; +then + GCDA_PATH=${SCRIPT_DIR%/*} + GCDA_PATH=${GCDA_PATH%/*} + GCDA_PATH=${GCDA_PATH%/*} + GCDA_FILE_PATH="/out/" + FINAL_GCDA_PATH=$GCDA_PATH$GCDA_FILE_PATH + ETS_FRONTEND=${SCRIPT_DIR%/*} + TEXT_NAME="/out/lcov_all" + TEXT_NAME_DIR=$ETS_FRONTEND$TEXT_NAME + mkdir -p $TEXT_NAME_DIR + TEXT_NAME=$TEXT_NAME_DIR/file_name.txt + find $FINAL_GCDA_PATH -name '*.gcda' > $TEXT_NAME + find $FINAL_GCDA_PATH -name '*.gcno' >> $TEXT_NAME + for line in $(cat $TEXT_NAME) + do + gcda_file_dir="" + gcda_file_dir=${line#*'out/'} + gcda_file_dir=$TEXT_NAME_DIR/gcda_file/$gcda_file_dir + gcda_file_dir=${gcda_file_dir%/*} + mkdir -p $gcda_file_dir + cp -rf $line $gcda_file_dir + done + # find $FINAL_GCDA_PATH -name '*.gcda' | xargs rm -rf + chmod +x $SCRIPT_DIR/llvm_gcov.sh + lcov -d $TEXT_NAME_DIR -o $TEXT_NAME_DIR/cov_oa_all.info -c --gcov-tool $SCRIPT_DIR/llvm_gcov.sh +fi \ No newline at end of file diff --git a/test262/llvm_gcov.sh b/test262/llvm_gcov.sh new file mode 100644 index 0000000000000000000000000000000000000000..5e956e8ff7d43d9d0535b2f4a3f2ef899920612d --- /dev/null +++ b/test262/llvm_gcov.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# 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. + +SCRIPT_DIR=$(cd $(dirname $0);pwd) +PREBUILTS=prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-cov +DIR=${SCRIPT_DIR%'arkcompiler'*} +DIR=$DIR$PREBUILTS +exec $DIR gcov "$@" \ No newline at end of file