Parcourir la source

up

Update main.yml

Update main.yml

up

Update main.yml

update

Update main.yml

up

Update 04_str.py

Update run_tests.sh
blueloveTH il y a 3 ans
Parent
commit
7a07eefed0
6 fichiers modifiés avec 31 ajouts et 11 suppressions
  1. 13 3
      .github/workflows/main.yml
  2. 1 0
      .gitignore
  3. 0 6
      run_test.sh
  4. 10 0
      run_tests.sh
  5. 1 1
      scripts/run_tests.py
  6. 6 1
      tests/04_str.py

+ 13 - 3
.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

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@ __pycache__/
 .ipynb_checkpoints
 .DS_Store
 .hidden
+.coverage
 
 src/main
 gmon.out

+ 0 - 6
run_test.sh

@@ -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

+ 10 - 0
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

+ 1 - 1
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)

+ 6 - 1
tests/04_str.py

@@ -70,4 +70,9 @@ def f():
 assert '|'.join(f()) == '0|1|2|3|4'
 
 num = 6
-assert str(num) == '6'
+assert str(num) == '6'
+
+# test Lo group names
+
+测试 = "test"
+assert 测试 == "test"