Esempio n. 1
0
 def test_str(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": ['foo']
         }, {
             "command": ["bar"]
         }]))
     self.assertEqual("opengrok-master", str(cmds))
Esempio n. 2
0
 def test_project_subst(self):
     cmds = Commands(
         CommandsBase("test-subst", [{
             "command": ["/bin/echo", Commands.PROJECT_SUBST]
         }]))
     cmds.run()
     self.assertEqual(['test-subst\n'],
                      cmds.outputs['/bin/echo test-subst'])
Esempio n. 3
0
 def test_terminate_after_non_zero_code(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": ["/bin/false"]
         }, {
             "command": ["/bin/true"]
         }]))
     cmds.run()
     self.assertEqual({'/bin/false opengrok-master': 1}, cmds.retcodes)
Esempio n. 4
0
 def test_terminate_after_non_zero_code(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": [
                 "/bin/sh", "-c",
                 "echo " + Commands.PROJECT_SUBST + "; exit 255"
             ]
         }, {
             "command": ["/bin/echo"]
         }]))
     cmds.run()
     self.assertEqual({'/bin/sh -c echo opengrok-master; exit 255': 255},
                      cmds.retcodes)
Esempio n. 5
0
 def test_exit_2_handling(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": [
                 "/bin/sh", "-c",
                 "echo " + Commands.PROJECT_SUBST + "; exit 2"
             ]
         }, {
             "command": ["/bin/echo"]
         }]))
     cmds.run()
     self.assertEqual({'/bin/sh -c echo opengrok-master; exit 2': 2},
                      cmds.retcodes)
     self.assertFalse(cmds.failed)
Esempio n. 6
0
 def test_run_retcodes_usr(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": ["/bin/echo"]
         }, {
             "command": ["/usr/bin/true"]
         }, {
             "command": ["/usr/bin/false"]
         }]))
     cmds.run()
     # print(p.retcodes)
     self.assertEqual(
         {
             '/bin/echo opengrok-master': 0,
             '/usr/bin/true opengrok-master': 0,
             '/usr/bin/false opengrok-master': 1
         }, cmds.retcodes)
Esempio n. 7
0
 def test_run_retcodes(self):
     cmds = Commands(
         CommandsBase("opengrok-master", [{
             "command": ["/bin/echo"]
         }, {
             "command": [
                 "/bin/sh", "-c",
                 "echo " + Commands.PROJECT_SUBST + "; exit 0"
             ]
         }, {
             "command": [
                 "/bin/sh", "-c",
                 "echo " + Commands.PROJECT_SUBST + "; exit 1"
             ]
         }]))
     cmds.run()
     self.assertEqual(
         {
             '/bin/echo opengrok-master': 0,
             '/bin/sh -c echo opengrok-master; exit 0': 0,
             '/bin/sh -c echo opengrok-master; exit 1': 1
         }, cmds.retcodes)