diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2021-05-31 17:52:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 17:52:16 +0200 |
commit | ef555f6a0b0ce6dfe0dae24b5c3f7a84292627a1 (patch) | |
tree | ee5d68302d73d4dcfd38099eb54e965fe6e31aec /nixos/tests | |
parent | 19acfe38282f6121bdcc2cfe0648d58ea6415801 (diff) | |
parent | dd54ac56484f446d063c2088d856c812531f72fc (diff) |
Merge pull request #123426 from mattchrist/brscan5
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/brscan5.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nixos/tests/brscan5.nix b/nixos/tests/brscan5.nix new file mode 100644 index 0000000000000..715191b383cb6 --- /dev/null +++ b/nixos/tests/brscan5.nix @@ -0,0 +1,42 @@ +# 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="ADS-1200"; nodename="BRW0080927AFBCE"; }; + "b" = { model="ADS-1200"; ip="192.168.1.2"; }; + }; + }; + }; + }; + + testScript = '' + # sane loads libsane-brother5.so.1 successfully, and scanimage doesn't die + 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 , "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 + ''; +}) |