summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2019-12-17 01:08:04 -0800
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-12-17 23:14:53 +0900
commit1209ef94bd09bdc67a7b51f084910a5982f2f010 (patch)
tree394c941daef8aba42d761cd622ec84a0871208f2 /test
parent4d92039fceed9645abdd1dc1b4e4d9aa47429b4d (diff)
downloadsystemd-1209ef94bd09bdc67a7b51f084910a5982f2f010.tar.gz
[import] fix stdin/stdout pipe behavior in import/export tar/raw
The code existed in machinectl to use stdin/stdout if the path for import/export tar/raw was empty or dash (-) but a check to `fd_verify_regular` in importd prevented it from working. Update the check instead to explicitly check for regular file or pipe/fifo. Fixes #14346
Diffstat (limited to 'test')
-rwxr-xr-xtest/TEST-25-IMPORT/testsuite.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/TEST-25-IMPORT/testsuite.sh b/test/TEST-25-IMPORT/testsuite.sh
index 380ba3d82d..d4efd71e06 100755
--- a/test/TEST-25-IMPORT/testsuite.sh
+++ b/test/TEST-25-IMPORT/testsuite.sh
@@ -119,6 +119,18 @@ machinectl remove scratch4
! test -f /var/lib/machines/scratch4
! machinectl image-status scratch4
+# Test import-tar hypen/stdin pipe behavior
+cat /var/tmp/scratch.tar.gz | machinectl import-tar - scratch5
+test -d /var/lib/machines/scratch5
+machinectl image-status scratch5
+diff -r /var/tmp/scratch/ /var/lib/machines/scratch5
+
+# Test export-tar hypen/stdout pipe behavior
+mkdir -p /var/tmp/extract
+machinectl export-tar scratch5 - | tar xvf - -C /var/tmp/extract/
+diff -r /var/tmp/scratch/ /var/tmp/extract/
+rm -rf /var/tmp/extract
+
rm -rf /var/tmp/scratch
echo OK > /testok