summaryrefslogtreecommitdiff
path: root/test/system/helpers.t
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-09-23 15:16:11 -0600
committerEd Santiago <santiago@redhat.com>2020-09-23 16:38:05 -0600
commite62848752561640ecad72901938d0c0c5c17ed9a (patch)
tree1499488ad50ee978d587b9096c5eccf63f642a64 /test/system/helpers.t
parenta6b300ef7ee19da0c590af9bbcd1a35de7fa8c84 (diff)
downloadpodman-e62848752561640ecad72901938d0c0c5c17ed9a.tar.gz
podman-e62848752561640ecad72901938d0c0c5c17ed9a.tar.bz2
podman-e62848752561640ecad72901938d0c0c5c17ed9a.zip
system tests: helpers: safer parse_table
The parse_table() helper has until now dumbly split lines on every single '|' character. This prevents us from running simple tests such as 'cgroupManager: (systemd|cgroupfs)'. We now use an ugly but robust sed expression to split on '|' but *only* when surrounded by spaces and/or beginning or end of line. This is safe because, for readability, all tables already keep the '|' symbols well separated from table content. Add tests. And, the whole reason behind this, add an actual real test for cgroupManager and cgroupVersion. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/helpers.t')
-rwxr-xr-xtest/system/helpers.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/system/helpers.t b/test/system/helpers.t
index 7a331174b..190e8ba35 100755
--- a/test/system/helpers.t
+++ b/test/system/helpers.t
@@ -85,7 +85,7 @@ while read x y z; do
check_result "$x" "''" "empty string - left-hand"
check_result "$y" "''" "empty string - middle"
check_result "$z" "''" "empty string - right"
-done < <(parse_table " | |")
+done < <(parse_table " | |")
# Quotes
while read x y z;do
@@ -108,6 +108,13 @@ while read x y z;do
check_result "$3" "g" "double quotes - token split - 3"
done < <(parse_table "a 'b c' | d \"e f\" g | h")
+# Split on '|' only when bracketed by spaces or at beginning/end of line
+while read x y z;do
+ check_result "$x" "|x" "pipe in strings - pipe at start"
+ check_result "$y" "y|y1" "pipe in strings - pipe in middle"
+ check_result "$z" "z|" "pipe in strings - pipe at end"
+done < <(parse_table "|x | y|y1 | z|")
+
# END test the parse_table helper
###############################################################################
# BEGIN dprint