@@ -62,17 +62,16 @@ def get_artifacts_list(target, raw_list):
return result
def retrieve_test_artifacts(target, artifacts_list, target_dir):
+ import io, subprocess
local_artifacts_dir = os.path.join(target_dir, "artifacts")
- for artifact_path in artifacts_list:
- if not os.path.isabs(artifact_path):
- bb.warn(f"{artifact_path} is not an absolute path")
- continue
- try:
- dest_dir = os.path.join(local_artifacts_dir, os.path.dirname(artifact_path[1:]))
- os.makedirs(dest_dir, exist_ok=True)
- target.copyFrom(artifact_path, dest_dir)
- except Exception as e:
- bb.warn(f"Can not retrieve {artifact_path} from test target: {e}")
+ try:
+ cmd = "tar zcf - " + " ".join(artifacts_list)
+ (status, output) = target.run(cmd, raw = True)
+ if status != 0 or not output:
+ raise Exception("Error while fetching compressed artifacts")
+ p = subprocess.run(["tar", "zxf", "-", "-C", local_artifacts_dir], input=output)
+ except Exception as e:
+ bb.warn(f"Can not retrieve {artifact_path} from test target: {e}")
def list_and_fetch_failed_tests_artifacts(d, tc):
artifacts_list = get_artifacts_list(tc.target, d.getVar("TESTIMAGE_FAILED_QA_ARTIFACTS"))