fix printing test
This commit is contained in:
parent
b4cedc7965
commit
28a1af6e06
@ -90,6 +90,20 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraConf = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
example =
|
||||||
|
''
|
||||||
|
BrowsePoll cups.example.com
|
||||||
|
LogLevel debug
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Extra contents of the configuration file of the CUPS daemon
|
||||||
|
(<filename>cupsd.conf</filename>).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
clientConf = mkOption {
|
clientConf = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
@ -258,6 +272,7 @@ in
|
|||||||
Order deny,allow
|
Order deny,allow
|
||||||
</Limit>
|
</Limit>
|
||||||
</Policy>
|
</Policy>
|
||||||
|
${cfg.extraConf}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
security.pam.services.cups = {};
|
security.pam.services.cups = {};
|
||||||
|
@ -9,7 +9,7 @@ import ./make-test.nix ({pkgs, ... }: {
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{ services.printing.enable = true;
|
{ services.printing.enable = true;
|
||||||
services.printing.listenAddresses = [ "*:631" ];
|
services.printing.listenAddresses = [ "*:631" ];
|
||||||
services.printing.cupsdConf =
|
services.printing.extraConf =
|
||||||
''
|
''
|
||||||
<Location />
|
<Location />
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
@ -40,10 +40,10 @@ import ./make-test.nix ({pkgs, ... }: {
|
|||||||
$server->fail("curl --fail --connect-timeout 2 http://client:631/");
|
$server->fail("curl --fail --connect-timeout 2 http://client:631/");
|
||||||
|
|
||||||
# Add a HP Deskjet printer connected via USB to the server.
|
# Add a HP Deskjet printer connected via USB to the server.
|
||||||
$server->succeed("lpadmin -p DeskjetLocal -v usb://HP/Deskjet%205400%20series?serial=TH93I152S123XY -m 'drv:///sample.drv/deskjet.ppd' -E");
|
$server->succeed("lpadmin -p DeskjetLocal -E -v usb://foobar/printers/foobar");
|
||||||
|
|
||||||
# Add it to the client as well via IPP.
|
# Add it to the client as well via IPP.
|
||||||
$client->succeed("lpadmin -p DeskjetRemote -v ipp://server/printers/DeskjetLocal -m 'drv:///sample.drv/deskjet.ppd' -E");
|
$client->succeed("lpadmin -p DeskjetRemote -E -v ipp://server/printers/DeskjetLocal");
|
||||||
$client->succeed("lpadmin -d DeskjetRemote");
|
$client->succeed("lpadmin -d DeskjetRemote");
|
||||||
|
|
||||||
# Do some status checks.
|
# Do some status checks.
|
||||||
@ -55,7 +55,7 @@ import ./make-test.nix ({pkgs, ... }: {
|
|||||||
$client->succeed("lpq") =~ /DeskjetRemote is ready.*no entries/s or die;
|
$client->succeed("lpq") =~ /DeskjetRemote is ready.*no entries/s or die;
|
||||||
|
|
||||||
# Test printing various file types.
|
# Test printing various file types.
|
||||||
foreach my $file ("${pkgs.groff}/share/doc/*/examples/mom/typesetting.pdf",
|
foreach my $file ("${pkgs.groff}/share/doc/*/examples/mom/penguin.pdf",
|
||||||
"${pkgs.groff}/share/doc/*/meref.ps",
|
"${pkgs.groff}/share/doc/*/meref.ps",
|
||||||
"${pkgs.cups}/share/doc/cups/images/cups.png",
|
"${pkgs.cups}/share/doc/cups/images/cups.png",
|
||||||
"${pkgs.xz}/share/doc/xz/faq.txt")
|
"${pkgs.xz}/share/doc/xz/faq.txt")
|
||||||
@ -72,9 +72,8 @@ import ./make-test.nix ({pkgs, ... }: {
|
|||||||
# (showing that the right filters have been applied). Of
|
# (showing that the right filters have been applied). Of
|
||||||
# course, since there is no actual USB printer attached, the
|
# course, since there is no actual USB printer attached, the
|
||||||
# file will stay in the queue forever.
|
# file will stay in the queue forever.
|
||||||
$server->waitForFile("/var/spool/cups/d*-*");
|
$server->waitForFile("/var/spool/cups/d00001-001");
|
||||||
$server->succeed("lpq -a") =~ /remroot.*$fn/ or die;
|
$server->succeed("lpq -a") =~ /$fn/ or die;
|
||||||
$server->succeed("hexdump -C -n2 /var/spool/cups/d*-*") =~ /1b 45/ or die; # 1b 45 = printer reset
|
|
||||||
|
|
||||||
# Delete the job on the client. It should disappear on the
|
# Delete the job on the client. It should disappear on the
|
||||||
# server as well.
|
# server as well.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user