mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 22:33:40 +08:00
Preserve coverage notes in safety build cleanup tests
This commit is contained in:
@@ -4,6 +4,7 @@ from concurrent.futures.process import BrokenProcessPool
|
||||
import importlib.util
|
||||
from collections import Counter
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
import unittest
|
||||
@@ -144,8 +145,12 @@ def test_native_variant(native_variant):
|
||||
with TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
library = Path(libsafety_py._build_libsafety(release=True, output_dir=root))
|
||||
self.assertEqual(list(root.iterdir()), [library])
|
||||
notes = set(root.glob("*.gcno"))
|
||||
self.assertEqual(len(notes), int(os.environ.get("SAFETY_COVERAGE") == "1"))
|
||||
self.assertEqual(set(root.iterdir()), {library, *notes})
|
||||
library.unlink()
|
||||
for note in notes:
|
||||
note.unlink()
|
||||
for calls in ((RuntimeError("compiler failed"),), (None, RuntimeError("compiler failed"))):
|
||||
with self.subTest(calls=len(calls)), patch.object(libsafety_py.subprocess, "check_call", side_effect=calls):
|
||||
with self.assertRaisesRegex(RuntimeError, "compiler failed"):
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "c338ab23b81cd24b17017d666cfce9d277520fee84c273011d95adff063f151b", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "ec16110505a2aa6def6dc914274dcf91300d7ad0d743e2dfd86a4f276fbf1ecb", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user