]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-systemd-tmpfiles.py
2 # SPDX-License-Identifier: LGPL-2.1+
4 # This file is part of systemd.
6 # systemd is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation; either version 2.1 of the License, or
9 # (at your option) any later version.
14 EX_DATAERR
= 65 # from sysexits.h
18 def test_invalid_line(line
):
19 print('Running {} on {!r}'.format(exe
, line
))
20 c
= subprocess
.run([exe
, '--create', '-'],
21 input=line
, stdout
=subprocess
.PIPE
, universal_newlines
=True)
22 assert c
.returncode
== EX_DATAERR
, c
24 if __name__
== '__main__':
25 test_invalid_line('asdfa')
26 test_invalid_line('f "open quote')
27 test_invalid_line('f closed quote""')
28 test_invalid_line('Y /unknown/letter')
29 test_invalid_line('w non/absolute/path')
30 test_invalid_line('s') # s is for short
31 test_invalid_line('f!! /too/many/bangs')
32 test_invalid_line('f++ /too/many/plusses')
33 test_invalid_line('f+!+ /too/many/plusses')
34 test_invalid_line('f!+! /too/many/bangs')
35 #test_invalid_line('w /unresolved/argument - - - - "%Y"')
36 #test_invalid_line('w /unresolved/argument/sandwich - - - - "%v%Y%v"')
37 #test_invalid_line('w /unresolved/filename/%Y - - - - "whatever"')
38 #test_invalid_line('w /unresolved/filename/sandwich/%v%Y%v - - - - "whatever"')
39 test_invalid_line('w - - - - - "no file specfied"')
40 test_invalid_line('C - - - - - "no file specfied"')
41 test_invalid_line('C non/absolute/path - - - - -')
42 test_invalid_line('b - - - - - -')
43 test_invalid_line('b 1234 - - - - -')
44 test_invalid_line('c - - - - - -')
45 test_invalid_line('c 1234 - - - - -')
46 test_invalid_line('t - - -')
47 test_invalid_line('T - - -')
48 test_invalid_line('a - - -')
49 test_invalid_line('A - - -')
50 test_invalid_line('h - - -')
51 test_invalid_line('H - - -')