summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rule-syntax-check.py2
-rw-r--r--test/sysv-generator-test.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py
index 80bbe65bea..e43a3daeb3 100644
--- a/test/rule-syntax-check.py
+++ b/test/rule-syntax-check.py
@@ -35,7 +35,7 @@ else:
no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
-no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
+no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"([^"]*)"$')
result = 0
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index af0493b9a8..23d6646bba 100644
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -190,6 +190,15 @@ class SysvGeneratorTest(unittest.TestCase):
self.assert_enabled('foo.service', ['multi-user', 'graphical'])
self.assertNotIn('Overwriting', err)
+ def test_simple_escaped(self):
+ '''simple service without dependencies, that requires escaping the name'''
+
+ self.add_sysv('foo+', {})
+ self.add_sysv('foo-admin', {})
+ err, results = self.run_generator()
+ self.assertEqual(list(results), ['foo-admin.service', 'foo\\x2b.service'])
+ self.assertNotIn('Overwriting', err)
+
def test_simple_enabled_some(self):
'''simple service without dependencies, enabled in some runlevels'''
@@ -276,6 +285,16 @@ class SysvGeneratorTest(unittest.TestCase):
'foo.service')
self.assertNotIn('Overwriting', err)
+ def test_provides_escaped(self):
+ '''a script that Provides: a name that requires escaping'''
+
+ self.add_sysv('foo', {'Provides': 'foo foo+'})
+ err, results = self.run_generator()
+ self.assertEqual(list(results), ['foo.service'])
+ self.assertEqual(os.readlink(os.path.join(self.out_dir, 'foo\\x2b.service')),
+ 'foo.service')
+ self.assertNotIn('Overwriting', err)
+
def test_same_provides_in_multiple_scripts(self):
'''multiple init.d scripts provide the same name'''