Skip to content

Commit 277b66f

Browse files
eddyz87danielocfb
authored andcommitted
[run-qemu] Add 'output_dir' action parameter
Add capability to extract contents of /command_output/ directory from the qemu disk image after qemu execution. This is useful when there is a need to extract multiple result files after tests run.
1 parent 9241819 commit 277b66f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

run-qemu/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ inputs:
1919
kernel-test:
2020
description: 'Test to run'
2121
default: ''
22+
output-dir:
23+
description: |
24+
Some sub-commands produce output dir within VM file system (/command_output/).
25+
If this option is set that dir's content would be copied to corresponding location.
26+
default: ''
2227
runs:
2328
using: "composite"
2429
steps:
@@ -37,5 +42,6 @@ runs:
3742
KERNEL_ROOT: ${{ inputs.kernel-root }}
3843
MAX_CPU: ${{ inputs.max-cpu }}
3944
KERNEL_TEST: ${{ inputs.kernel-test }}
45+
OUTPUT_DIR: ${{ inputs.output-dir }}
4046
run: |
4147
ARCH="${{ inputs.arch }}" ${GITHUB_ACTION_PATH}/run.sh

run-qemu/run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ then
114114
"${GITHUB_ACTION_PATH}/print_test_summary.py" -s "${GITHUB_STEP_SUMMARY}" -j "${KERNEL_TEST}.json"
115115
fi
116116
fi
117+
118+
# Try to collect $IMG:/command_output to OUTPUT_DIR
119+
if [[ -n "${OUTPUT_DIR}" ]]
120+
then
121+
mkdir -p "${OUTPUT_DIR}"
122+
guestfish --ro --add "$IMG" --inspector tar-out /command_output/ - \
123+
| tar --extract --file - --directory="${OUTPUT_DIR}"
124+
fi
125+
117126
# Final summary - Don't use a fold, keep it visible
118127
echo -e "\033[1;33mTest Results:\033[0m"
119128
echo -e "$exitfile" | while read result; do

0 commit comments

Comments
 (0)