about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorMatt Christ <matt@christ.systems>2021-05-23 08:03:19 -0500
committerMatt Christ <matt@christ.systems>2021-05-23 08:08:31 -0500
commit14bf8f109be960a7d7b1c6187b20b56c7edfe9d3 (patch)
treea446f1a9b57670a9de1792f0209335e3d241644c /nixos/tests
parenta9b7300f6fac43011318554c0b942fa143b8a392 (diff)
fix brscan5 config generation
before this, the config utility was unable to locate the models folder
update tests to use a compatible model
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/brscan5.nix18
1 files changed, 13 insertions, 5 deletions
diff --git a/nixos/tests/brscan5.nix b/nixos/tests/brscan5.nix
index af5333126b552..715191b383cb6 100644
--- a/nixos/tests/brscan5.nix
+++ b/nixos/tests/brscan5.nix
@@ -15,8 +15,8 @@ import ./make-test-python.nix ({ pkgs, ...} : {
         brscan5 = {
           enable = true;
           netDevices = {
-            "a" = { model="MFC-7860DW"; nodename="BRW0080927AFBCE"; };
-            "b" = { model="MFC-7860DW"; ip="192.168.1.2"; };
+            "a" = { model="ADS-1200"; nodename="BRW0080927AFBCE"; };
+            "b" = { model="ADS-1200"; ip="192.168.1.2"; };
           };
         };
       };
@@ -24,11 +24,19 @@ import ./make-test-python.nix ({ pkgs, ...} : {
 
   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')
+    strace = machine.succeed('strace scanimage -L 2>&1').split("\n")
+    regexp = 'openat\(.*libsane-brother5.so.1", O_RDONLY|O_CLOEXEC\) = \d\d*$'
+    assert len([x for x in strace if re.match(regexp,x)]) > 0
 
     # 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
+    assert 'DEVICE=a , "ADS-1200" , 0x4f9:0x459 , NODENAME=BRW0080927AFBCE' in cfg
+    assert 'DEVICE=b , "ADS-1200" , 0x4f9:0x459 , IP-ADDRESS=192.168.1.2' in cfg
+
+    # scanimage lists the two network scanners
+    scanimage = machine.succeed("scanimage -L")
+    print(scanimage)
+    assert """device `brother5:net1;dev0' is a Brother b ADS-1200""" in scanimage
+    assert """device `brother5:net1;dev1' is a Brother a ADS-1200""" in scanimage
   '';
 })