Fix: Tests: trace path wildcards not expanded
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 17 Mar 2020 21:48:40 +0000 (17:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Mar 2020 05:29:06 +0000 (01:29 -0400)
Issue
=====
Some testcases related to `--live` sessions in
`tools/clear/{test_ust,test_kernel}` fail with the following error:
  ls: cannot access '/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*': No such file or directory
  not ok 61 - Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"
  FAIL: tools/clear/test_ust 61 - Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"
  #   Failed test 'Failed to list content of directory "/tmp/tmp.gi1eVM3fZ9/tmp.dNL0WHRTQ3/ci-node-bionic-amd64-02-04/LUP49x7iV7xexehS*"'
  #   in ./tools/clear//../../../utils/tap/tap.sh:fail() at line 159.

They fail because the wildcard character `*` is used in a path and is
not expanded when comes the time to list the content of the expanded
path.

In `--live` related tests, we use a wildcard in those paths because we
can't know the full name of the output directory as it's named by the
sessiond.

This bug was introduced (or rather not fixed) by the following commit:
  commit 94360c17201a28466af49058735166c73f9ae130
  Author: Francis Deslauriers <francis.deslauriers@efficios.com>
  Date:   Fri Mar 6 18:18:14 2020 -0500

      Fix: Tests: utils.sh: merge `validate_{directory,folder_is}_empty` functions

Solution
========
Remove the double quotes around the path variable so that wildcards can
be expanded as expected.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If4a72fab0d487cf6e6b021dfad9eca6d0d60d5f4
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/utils.sh

index b326c5bcf94166358e341217078aa1721bb2c8e7..88a4ddd20c30216d6f19ea07b4160df998cb3c9b 100644 (file)
@@ -1860,7 +1860,9 @@ function validate_directory_empty ()
 {
        local trace_path="$1"
 
 {
        local trace_path="$1"
 
-       files="$(ls -A "$trace_path")"
+       # Do not double quote `$trace_path` below as we want wildcards to be
+       # expanded.
+       files="$(ls -A $trace_path)"
        ret=$?
        if [ $ret -ne 0 ]; then
                fail "Failed to list content of directory \"$trace_path\""
        ret=$?
        if [ $ret -ne 0 ]; then
                fail "Failed to list content of directory \"$trace_path\""
This page took 0.027285 seconds and 5 git commands to generate.