aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/with_coverage.py
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
committeralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
commitbf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch)
tree1d1df72c0541a59a81439842f46d95396d3e7189 /build/scripts/with_coverage.py
parent8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff)
downloadydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz
add ymake export to ydb
Diffstat (limited to 'build/scripts/with_coverage.py')
-rw-r--r--build/scripts/with_coverage.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/build/scripts/with_coverage.py b/build/scripts/with_coverage.py
new file mode 100644
index 0000000000..d62435c3b8
--- /dev/null
+++ b/build/scripts/with_coverage.py
@@ -0,0 +1,40 @@
+# TODO prettyboy remove after ya-bin release
+
+import os
+import sys
+import subprocess
+import tarfile
+import random
+import shutil
+
+
+def mkdir_p(path):
+ try:
+ os.makedirs(path)
+ except OSError:
+ pass
+
+
+def main(args):
+ coverage_path = os.path.abspath(args[0])
+ coverage_dir = coverage_path + '.' + str(random.getrandbits(64))
+
+ mkdir_p(coverage_dir)
+
+ env = os.environ.copy()
+ env['GCOV_PREFIX'] = coverage_dir
+
+ subprocess.check_call(args[1:], env=env)
+
+ arch_path = coverage_dir + '.archive'
+
+ with tarfile.open(arch_path, 'w:') as tar:
+ tar.add(coverage_dir, arcname='.')
+
+ os.rename(arch_path, coverage_path)
+
+ shutil.rmtree(coverage_dir)
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])