Skip to contentSkip to conversation

oeqa/postactions: save ptests artifacts as archive on host

PATCH In review Alexis Lothoré 3 participants 7 messages Aug 12, 2024 – Sep 19, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover oeqa/postactions: save ptests artifacts as archive on host

Hello,

on any ptest failure, testimage build a list of artifacts to retrieve from the target under test, create an archive and pull the corresponding raw stream onto the controlling host (eg: autobuilder), which uncompresses it immediately.
This small series follows a request to keep those artifacts compressed instead of uncompressing them on the host.

The first commit is kind of unrelated and fixes a trivial issue spotted during some tests. The second commit makes sure that artifacts are kept in a compressed archive on the host.

Alexis Lothoré (2):
oeqa/postactions: fix exception handling oeqa/postactions: do not uncompress retrieved archive on host

 meta/lib/oeqa/utils/postactions.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.46.0
#1 lore raw

PATCH 1/2 oeqa/postactions: fix exception handling

From: Alexis Lothoré <[email protected]>

The current exception handler in list_and_fetch_failed_tests_artifacts expects a non-exisiting variable and then fail to display the original exception message since it raises a new one. The issue has been introduced with commit 6e80b2ab660e ("oeqa/utils/postactions: transfer whole archive over ssh instead of doing individual copies"). Now that tests artifacts are now handled individually, there's no point of trying to print individual names in the exception.

---
 meta/lib/oeqa/utils/postactions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/utils/postactions.py +1 -1
index 2de2d18328ea..3b537146c50a 100644
@@ -70,7 +70,7 @@ def list_and_fetch_failed_tests_artifacts(d, tc, artifacts_list, outputdir):
             raise Exception("Error while fetching compressed artifacts")
         p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output)
     except Exception as e:
-        bb.warn(f"Can not retrieve {artifact_path} from test target: {e}")
+        bb.warn(f"Can not retrieve artifacts from test target: {e}")
 
 
 ##################################################################
Signature · 1 line
2.46.0
#2 lore raw

PATCH 2/2 oeqa/postactions: do not uncompress retrieved archive on host

In reply to Alexis Lothoré

From: Alexis Lothoré <[email protected]>

Current postaction module executes a remote tar command, pipe it in a SSH connection, and uncompress the raw stream with another tar command. With this command, the whole artifacts tree is directly available on the host executing the test, but it is not very convenient if we want to download the whole retrieved ptests directory.

Stop uncompressing the retrieved ptests archive onto host, just save the archive as it is. The new output then looks like the following:

tmp/log/oeqa-artefacts

└── oeqa-target-artefacts-20240812-juzqdb80
    ├── host_disk_usage.txt
    ├── target_disk_usage.txt
    └── tests_artifacts.tar.gz
---
 meta/lib/oeqa/utils/postactions.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/postactions.py +2 -1
index 3b537146c50a..d5080523aa83 100644
@@ -68,7 +68,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc, artifacts_list, outputdir):
         (status, output) = tc.target.run(cmd, raw = True)
         if status != 0 or not output:
             raise Exception("Error while fetching compressed artifacts")
-        p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output)
+        with open(archive_name, "wb") as f:
+            f.write(output)
     except Exception as e:
         bb.warn(f"Can not retrieve artifacts from test target: {e}")
 
Signature · 1 line
2.46.0
#3 lore raw

Re: [OE-core] [PATCH 2/2] oeqa/postactions: do not uncompress retrieved archive on host

Quoted 29 lines · Alexis Lothoré via lists.openembedded.org

From: Alexis Lothoré <[email protected]>

Current postaction module executes a remote tar command, pipe it in a SSH connection, and uncompress the raw stream with another tar command. With this command, the whole artifacts tree is directly available on the host executing the test, but it is not very convenient if we want to download the whole retrieved ptests directory.

Stop uncompressing the retrieved ptests archive onto host, just save the archive as it is. The new output then looks like the following:

tmp/log/oeqa-artefacts

└── oeqa-target-artefacts-20240812-juzqdb80
    ├── host_disk_usage.txt
    ├── target_disk_usage.txt
    └── tests_artifacts.tar.gz

---
 meta/lib/oeqa/utils/postactions.py | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/postactions.py +0 -0
index 3b537146c50a..d5080523aa83 100644
@@ -68,7 +68,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc, artifacts_list, outputdir):
          (status, output) = tc.target.run(cmd, raw = True)
Quoted 7 lines

         if status != 0 or not output:
             raise Exception("Error while fetching compressed artifacts") -        p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output) +        with open(archive_name, "wb") as f:
+            f.write(output)
     except Exception as e:
         bb.warn(f"Can not retrieve artifacts from test target: {e}")

This change is causing failures since archive_name isn't defined anywhere :/

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [OE-core] [PATCH 2/2] oeqa/postactions: do not uncompress retrieved archive on host

Quoted 44 lines · Richard Purdie via lists.openembedded.org
Quoted 42 lines · Alexis Lothoré via lists.openembedded.org

From: Alexis Lothoré <[email protected]>

Current postaction module executes a remote tar command, pipe it in a SSH
connection, and uncompress the raw stream with another tar command. With
this command, the whole artifacts tree is directly available on the host
executing the test, but it is not very convenient if we want to download
the whole retrieved ptests directory.

Stop uncompressing the retrieved ptests archive onto host, just save the
archive as it is. The new output then looks like the following:

tmp/log/oeqa-artefacts

└── oeqa-target-artefacts-20240812-juzqdb80
    ├── host_disk_usage.txt
    ├── target_disk_usage.txt
    └── tests_artifacts.tar.gz

---
 meta/lib/oeqa/utils/postactions.py | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/postactions.py +0 -0
index 3b537146c50a..d5080523aa83 100644
@@ -68,7 +68,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc,

artifacts_list, outputdir):
         (status, output) = tc.target.run(cmd, raw = True) if status != 0 or not output:
             raise Exception("Error while fetching compressed artifacts")
-        p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output)
+        with open(archive_name, "wb") as f:

Quoted 8 lines
Quoted 4 lines

+            f.write(output)
     except Exception as e:
         bb.warn(f"Can not retrieve artifacts from test target:
{e}")

This change is causing failures since archive_name isn't defined anywhere :/

I'd also note that scarthgap actually throws errors:

https://valkyrie.yoctoproject.org/#/builders/73/builds/135/steps/12/logs/stdio

Exception: NameError: name 'artifact_path' is not defined

which is related to some of these patches :/.

Cheers,

Richard

#6 lore raw

Re: [OE-core] [PATCH 2/2] oeqa/postactions: do not uncompress retrieved archive on host

Hello Richard,

Quoted 5 lines · Richard Purdie
Quoted 3 lines · Richard Purdie via lists.openembedded.org
Quoted 1 line · Alexis Lothoré via lists.openembedded.org

From: Alexis Lothoré <[email protected]>

[...]

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
meta/lib/oeqa/utils/postactions.py +0 -0
@@ -68,7 +68,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc,

artifacts_list, outputdir):
         (status, output) = tc.target.run(cmd, raw = True) if status != 0 or not output:
             raise Exception("Error while fetching compressed artifacts")
-        p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output)
+        with open(archive_name, "wb") as f:

Quoted 8 lines
Quoted 4 lines

+            f.write(output)
     except Exception as e:
         bb.warn(f"Can not retrieve artifacts from test target:
{e}")

This change is causing failures since archive_name isn't defined anywhere :/

Quoted 7 lines

I'd also note that scarthgap actually throws errors:

https://valkyrie.yoctoproject.org/#/builders/73/builds/135/steps/12/logs/stdio

Exception: NameError: name 'artifact_path' is not defined

which is related to some of these patches :/.

I am out of office right now with limited access to computer (I come back next week but then I will be traveling to attend Kernel Recipes). If no one fixes it before, I'll take a look and send a fix once I return to the office (end of next week)

Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

Re: [OE-core] [PATCH 2/2] oeqa/postactions: do not uncompress retrieved archive on host

Quoted 35 lines · Alexis Lothor�

Hello Richard,

Quoted 5 lines · Richard Purdie
Quoted 3 lines · Richard Purdie via lists.openembedded.org
Quoted 1 line · Alexis Lothor� via lists.openembedded.org

From: Alexis Lothor� <[email protected]>

[...]

Quoted 24 lines
Quoted 11 lines
Quoted 11 lines
meta/lib/oeqa/utils/postactions.py +0 -0
@@ -68,7 +68,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc,

artifacts_list, outputdir):
�������� (status, output) = tc.target.run(cmd, raw = True) �������� if status != 0 or not output:
������������ raise Exception("Error while fetching compressed artifacts")
-������� p = subprocess.run(["tar", "zxf", "-", "-C", outputdir], input=output)
+������� with open(archive_name, "wb") as f:

Quoted 8 lines
Quoted 4 lines

+����������� f.write(output)
���� except Exception as e:
�������� bb.warn(f"Can not retrieve artifacts from test target:
{e}")

This change is causing failures since archive_name isn't defined anywhere :/

I'd also note that scarthgap actually throws errors:

https://valkyrie.yoctoproject.org/#/builders/73/builds/135/steps/12/logs/stdio

Quoted 9 lines
Quoted 3 lines

Exception: NameError: name 'artifact_path' is not defined

which is related to some of these patches :/.

I am out of office right now with limited access to computer (I come back next week but then I will be traveling to attend Kernel Recipes). If no one fixes it before, I'll take a look and send a fix once I return to the office (end of next week)

Mathieu is going to take care of this tomorrow/beginning of next week.

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com