Skip to content

Commit 6f01881

Browse files
committed
testsuite: fix random-generation of kvs archive files in t0021
Problem: the randbytes() function in t0021-archive-cmd.t uses /dev/random to create files of size 128 and 2048 bytes, respectively. However, /dev/random can be truncated at <128 bytes and, when it is, the file created by dd will be as well. This causes a size mismatch in the kvs, which causes tests 13, 14, and 18 to fail. This first showed up in GitLab CI on TOSS 4. We can instead utilize the /dev/urandom file, which is not truncated, and thus guaranteed to create files of the proper sizes. Also, some cleanup of t0021-archive-cmd.t is baked into this PR. When merged, closes issue #5750.
1 parent 74cc138 commit 6f01881

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

t/t0021-archive-cmd.t

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
test_description='Test flux-archive'
44

5-
. `dirname $0`/content/content-helper.sh
6-
75
. `dirname $0`/sharness.sh
86

97
test_under_flux 2
@@ -15,7 +13,7 @@ umask 022
1513

1614
# Usage: randbytes bytes
1715
randbytes() {
18-
dd if=/dev/random bs=$1 count=1
16+
dd if=/dev/urandom bs=$1 count=1
1917
}
2018

2119
test_expect_success 'flux archive create --badopt prints unrecognized option' '
@@ -86,7 +84,7 @@ test_expect_success 'flux archive list works' '
8684
test_cmp list.exp list.out
8785
'
8886
test_expect_success 'flux archive list -l works' '
89-
flux archive list --l >list_l.out &&
87+
flux archive list -l >list_l.out &&
9088
cat >list_l.exp <<-EOT &&
9189
f 0644 2048 testfile2
9290
d 0755 0 testdir

0 commit comments

Comments
 (0)