#!/bin/sh
set -eu

# Load the plugin by name (e.g "qdl") rather than the full path to the .so
# proves it was installed into the directory nbdkit expected.
#
# The plugin is not exercised beyond loading as serving a LUN would need a
# Qualcomm processor in EDL mode on the USB bus (or some kind of emulator...);
# the plugin waits indefinitely for an EDL device to appear without timing out.

output=$(nbdkit --dump-plugin qdl)
printf '%s\n' "$output"

printf '%s\n' "$output" | grep -q '^name=qdl$' || {
  echo "FAIL: --dump-plugin did not report name=qdl" >&2
  exit 1
}
