[Libguestfs] [nbdkit PATCH v2 12/24] test-eflags: Test .can_cache support

Eric Blake eblake at redhat.com
Thu May 16 03:58:02 UTC 2019


The sh bindings make this one easy to test.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 tests/test-eflags.sh | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/test-eflags.sh b/tests/test-eflags.sh
index 6a90b87..eaaaae0 100755
--- a/tests/test-eflags.sh
+++ b/tests/test-eflags.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 # nbdkit
-# Copyright (C) 2018 Red Hat Inc.
+# Copyright (C) 2018-2019 Red Hat Inc.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -286,3 +286,18 @@ EOF

 [ $eflags -eq $(( HAS_FLAGS|READ_ONLY|SEND_DF|CAN_MULTI_CONN )) ] ||
     fail "expected HAS_FLAGS|READ_ONLY|SEND_DF|CAN_MULTI_CONN"
+
+#----------------------------------------------------------------------
+# -r
+# can_cache=true
+
+do_nbdkit -r <<'EOF'
+case "$1" in
+     get_size) echo 1M ;;
+     can_cache) echo "emulate" ;;
+     *) exit 2 ;;
+esac
+EOF
+
+[ $eflags -eq $(( HAS_FLAGS|READ_ONLY|SEND_DF|SEND_CACHE )) ] ||
+    fail "expected HAS_FLAGS|READ_ONLY|SEND_DF|SEND_CACHE"
-- 
2.20.1




More information about the Libguestfs mailing list