about summary refs log tree commit diff
path: root/nixos/tests/brscan5.nix
diff options
context:
space:
mode:
authorMatt Christ <matt@christ.systems>2021-05-21 12:59:30 -0500
committerMatt Christ <matt@christ.systems>2021-05-21 12:59:30 -0500
commita9b7300f6fac43011318554c0b942fa143b8a392 (patch)
tree3a58fb3813e63497b19f179e95874dfaf0702274 /nixos/tests/brscan5.nix
parentfba98bad71596ffc963fb14140760d2e4abb0a4d (diff)
brscan5: init at 1.2.6-0
Diffstat (limited to 'nixos/tests/brscan5.nix')
-rw-r--r--nixos/tests/brscan5.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/tests/brscan5.nix b/nixos/tests/brscan5.nix
new file mode 100644
index 0000000000000..af5333126b552
--- /dev/null
+++ b/nixos/tests/brscan5.nix
@@ -0,0 +1,34 @@
+# integration tests for brscan5 sane driver
+#
+
+import ./make-test-python.nix ({ pkgs, ...} : {
+  name = "brscan5";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ mattchrist ];
+  };
+
+  machine = { pkgs, ... }:
+    {
+      nixpkgs.config.allowUnfree = true;
+      hardware.sane = {
+        enable = true;
+        brscan5 = {
+          enable = true;
+          netDevices = {
+            "a" = { model="MFC-7860DW"; nodename="BRW0080927AFBCE"; };
+            "b" = { model="MFC-7860DW"; ip="192.168.1.2"; };
+          };
+        };
+      };
+    };
+
+  testScript = ''
+    # sane loads libsane-brother5.so.1 successfully, and scanimage doesn't die
+    assert 'libsane-brother5.so.1", O_RDONLY|O_CLOEXEC) = 10' in machine.succeed('strace scanimage -L 2>&1')
+
+    # module creates a config
+    cfg = machine.succeed('cat /etc/opt/brother/scanner/brscan5/brsanenetdevice.cfg')
+    assert 'DEVICE=a , "MFC-7860DW" , Unknown , NODENAME=BRW0080927AFBCE' in cfg
+    assert 'DEVICE=b , "MFC-7860DW" , Unknown , IP-ADDRESS=192.168.1.2' in cfg
+  '';
+})