1 import ./make-test-python.nix ({ pkgs, lib, ... }:
5 meta.maintainers = [ lib.maintainers.aanderse ];
9 { services.incron.enable = true;
10 services.incron.extraPackages = [ pkgs.coreutils ];
11 services.incron.systab = ''
12 /test IN_CREATE,IN_MODIFY,IN_CLOSE_WRITE,IN_MOVED_FROM,IN_MOVED_TO echo "$@/$# $%" >> /root/incron.log
15 # ensure the directory to be monitored exists before incron is started
16 system.activationScripts.incronTest = ''
24 machine.wait_for_unit("multi-user.target")
25 machine.wait_for_unit("incron.service")
27 machine.succeed("test -d /test")
28 # create some activity for incron to monitor
29 machine.succeed("touch /test/file")
30 machine.succeed("echo foo >> /test/file")
31 machine.succeed("mv /test/file /root")
32 machine.succeed("mv /root/file /test")
37 machine.succeed("grep '/test/file IN_CREATE' /root/incron.log")
39 # echo foo >> /test/file
40 machine.succeed("grep '/test/file IN_MODIFY' /root/incron.log")
41 machine.succeed("grep '/test/file IN_CLOSE_WRITE' /root/incron.log")
44 machine.succeed("grep '/test/file IN_MOVED_FROM' /root/incron.log")
47 machine.succeed("grep '/test/file IN_MOVED_TO' /root/incron.log")
49 # ensure something unexpected is not present
50 machine.fail("grep 'IN_OPEN' /root/incron.log")