From 7a07eefed0028471b7ab87233da278ac2bbb14ec Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 17 Mar 2023 03:07:19 +0800 Subject: [PATCH] up Update main.yml Update main.yml up Update main.yml update Update main.yml up Update 04_str.py Update run_tests.sh --- .github/workflows/main.yml | 16 +++++++++++++--- .gitignore | 1 + run_test.sh | 6 ------ run_tests.sh | 10 ++++++++++ scripts/run_tests.py | 2 +- tests/04_str.py | 7 ++++++- 6 files changed, 31 insertions(+), 11 deletions(-) delete mode 100644 run_test.sh create mode 100644 run_tests.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26d3e33d..bcc0bc09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v3 - - name: Set up Clang + - name: Setup Clang uses: egor-tensin/setup-clang@v1 with: version: 15 @@ -53,14 +53,24 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Clang + - name: Setup Clang uses: egor-tensin/setup-clang@v1 with: version: 15 platform: x64 + - name: Install Dependencies + run: | + sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev + - name: Coverage Test + run: | + python3 preprocess.py + bash run_tests.sh + - uses: actions/upload-artifact@v3 + with: + name: coverage + path: .coverage - name: Compiling run: | - sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 python3 build.py linux python3 build.py linux -lib python3 scripts/run_tests.py diff --git a/.gitignore b/.gitignore index 60c2171b..33c370e4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ .ipynb_checkpoints .DS_Store .hidden +.coverage src/main gmon.out diff --git a/run_test.sh b/run_test.sh deleted file mode 100644 index 29b45c31..00000000 --- a/run_test.sh +++ /dev/null @@ -1,6 +0,0 @@ -clang++ -std=c++17 -fno-rtti --coverage -Wall -o pocketpy src/main.cpp -python3 scripts/run_tests.py -llvm-cov-15 gcov main.gc -r -s src/ -rm -rf .coverage -mkdir -p .coverage -mv *.gcov .coverage \ No newline at end of file diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 00000000..f78eae36 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,10 @@ +clang++ -std=c++17 -fno-rtti --coverage -stdlib=libc++ -Wall -o pocketpy src/main.cpp +python3 scripts/run_tests.py +rm -rf .coverage +mkdir -p .coverage +llvm-cov-15 gcov main.gc -r -s src/ >> .coverage/coverage.txt +mv *.gcov .coverage +rm main.gc* + +# -fprofile-instr-generate -fcoverage-mapping +# llvm-cov-15 show main.gc -instr-profile=default.profraw -format=html -output-dir .coverage \ No newline at end of file diff --git a/scripts/run_tests.py b/scripts/run_tests.py index bff4f6f5..8641d221 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -12,7 +12,7 @@ def test_file(filepath, cpython=False): def test_dir(path): print("Testing directory:", path) - for filename in os.listdir(path): + for filename in sorted(os.listdir(path)): if not filename.endswith('.py'): continue filepath = os.path.join(path, filename) diff --git a/tests/04_str.py b/tests/04_str.py index cdccf99c..a45b3133 100644 --- a/tests/04_str.py +++ b/tests/04_str.py @@ -70,4 +70,9 @@ def f(): assert '|'.join(f()) == '0|1|2|3|4' num = 6 -assert str(num) == '6' \ No newline at end of file +assert str(num) == '6' + +# test Lo group names + +测试 = "test" +assert 测试 == "test" \ No newline at end of file