From 715519bf95babeabf28855e2f1e6f9200bdd51e1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 11 Jun 2019 07:30:31 +0200 Subject: tests/luks2-bcache: Wait for cache device When chomping the cache set UUID introduced in 6ae9056a5a82dd16b745188a7ee6122ed27239f0, this actually has brought a bug to surface, because when the UUID wasn't chomped the cache device hasn't been attached at all, because the resulting command looked like this: echo f994bcca-8e52-4b54-9c96-5f5af0711b55 > /sys/block/$bcache1/bcache/attach Yes, that's a newline after the echo, so it's just echoing the UUID and then writes *nothing* into /sys/block/$bcache1/bcache/attach. Chomping the UUID now results in an error, because the attach is made directly after creating the device. So all we need to do here is wait until the cache device was registered and then do the attach. Signed-off-by: aszlig --- tests/aszlig/dnyarri/luks2-bcache.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/aszlig/dnyarri/luks2-bcache.nix b/tests/aszlig/dnyarri/luks2-bcache.nix index b81e6f47..0347a0da 100644 --- a/tests/aszlig/dnyarri/luks2-bcache.nix +++ b/tests/aszlig/dnyarri/luks2-bcache.nix @@ -94,6 +94,10 @@ ); chomp $csetuuid; + $newmachine->nest('wait for cache device to appear', sub { + $newmachine->waitUntilSucceeds("test -e /sys/fs/bcache/$csetuuid"); + }); + $newmachine->succeed( "echo $csetuuid > /sys/block/$bcache1/bcache/attach", "echo writeback > /sys/block/$bcache1/bcache/cache_mode", -- cgit 1.4.1