in bot/code_coverage_bot/chunk_mapping.py [0:0]
def generate(repo_dir, revision, artifactsHandler, out_dir="."):
logger.info("Generating chunk mapping...")
# TODO: Change chunk_mapping to test_mapping, but the name should be synced in mozilla-central
# in the coverage selector!
per_test_sqlite_file = os.path.join(out_dir, "chunk_mapping.sqlite")
per_test_tarxz_file = os.path.join(out_dir, "chunk_mapping.tar.xz")
per_chunk_sqlite_file = os.path.join(out_dir, "per_chunk_mapping.sqlite")
per_chunk_tarxz_file = os.path.join(out_dir, "per_chunk_mapping.tar.xz")
logger.info("Creating tables.")
with sqlite3.connect(per_test_sqlite_file) as per_test_conn:
per_test_cursor = per_test_conn.cursor()
with sqlite3.connect(per_chunk_sqlite_file) as per_chunk_conn:
per_chunk_cursor = per_chunk_conn.cursor()
with ThreadPoolExecutor(max_workers=4) as executor:
_inner_generate(
repo_dir,
revision,
artifactsHandler,
per_test_cursor,
per_chunk_cursor,
executor,
)
logger.info(
"Writing the per-test mapping archive at {}.".format(per_test_tarxz_file)
)
with tarfile.open(per_test_tarxz_file, "w:xz") as tar:
tar.add(per_test_sqlite_file, os.path.basename(per_test_sqlite_file))
logger.info(
"Writing the per-chunk mapping archive at {}.".format(per_chunk_tarxz_file)
)
with tarfile.open(per_chunk_tarxz_file, "w:xz") as tar:
tar.add(per_chunk_sqlite_file, os.path.basename(per_chunk_sqlite_file))