예제 #1
0
    def testShellArgsAreRenderedAnewAtEachBuild(self):
        """Unit test to ensure that ShellArg instances are properly re-rendered.

        This unit test makes sure that ShellArg instances are rendered anew at
        each new build.
        """
        arg = shellsequence.ShellArg(
            command=WithProperties('make %s', 'project'),
            logfile=WithProperties('make %s', 'project'))
        step = shellsequence.ShellSequence(commands=[arg], workdir='build')

        # First "build"
        self.setupStep(step)
        self.properties.setProperty("project", "BUILDBOT-TEST-1", "TEST")
        self.expectCommands(
            ExpectShell(workdir='build', command='make BUILDBOT-TEST-1') + 0 +
            Expect.log('stdio make BUILDBOT-TEST-1'))
        self.expectOutcome(result=SUCCESS,
                           state_string="'make BUILDBOT-TEST-1'")
        self.runStep()

        # Second "build"
        self.setupStep(step)
        self.properties.setProperty("project", "BUILDBOT-TEST-2", "TEST")
        self.expectCommands(
            ExpectShell(workdir='build', command='make BUILDBOT-TEST-2') + 0 +
            Expect.log('stdio make BUILDBOT-TEST-2'))
        self.expectOutcome(result=SUCCESS,
                           state_string="'make BUILDBOT-TEST-2'")

        return self.runStep()
예제 #2
0
    def testSequenceStopsOnHaltOnFailure(self):
        arg1 = shellsequence.ShellArg(command='make p1', haltOnFailure=True)
        arg2 = shellsequence.ShellArg(command='deploy p1')

        self.setupStep(
            shellsequence.ShellSequence(commands=[arg1, arg2],
                                        workdir='build'))
        self.expectCommands(ExpectShell(workdir='build', command='make p1') + 1)
        self.expectOutcome(result=FAILURE, state_string="'make p1'")
        return self.runStep()
예제 #3
0
 def testMultipleCommandsAreRun(self):
     arg1 = shellsequence.ShellArg(command='make p1')
     arg2 = shellsequence.ShellArg(command='deploy p1')
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1, arg2],
                                     workdir='build'))
     self.expectCommands(
         ExpectShell(workdir='build', command='make p1') + 0,
         ExpectShell(workdir='build', command='deploy p1') + 0)
     self.expectOutcome(result=SUCCESS, state_string="'deploy p1'")
     return self.runStep()
예제 #4
0
 def testShellArgsAreRendered(self):
     arg1 = shellsequence.ShellArg(
         command=WithProperties('make %s', 'project'))
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1], workdir='build'))
     self.properties.setProperty("project", "BUILDBOT-TEST", "TEST")
     self.expectCommands(
         ExpectShell(workdir='build', command='make BUILDBOT-TEST') + 0)
     # TODO: need to factor command-summary stuff into a utility method and
     # use it here
     self.expectOutcome(result=SUCCESS, state_string="'make BUILDBOT-TEST'")
     return self.runStep()
예제 #5
0
 def testWarningWins(self):
     arg1 = shellsequence.ShellArg(command='make p1',
                                   warnOnFailure=True,
                                   flunkOnFailure=False)
     arg2 = shellsequence.ShellArg(command='deploy p1')
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1, arg2],
                                     workdir='build'))
     self.expectCommands(ExpectShell(workdir='build', command='make p1') + 1,
                         ExpectShell(workdir='build', command='deploy p1') + 0)
     self.expectOutcome(result=WARNINGS, state_string="'deploy p1'")
     return self.runStep()
예제 #6
0
 def testSkipWorks(self):
     arg1 = shellsequence.ShellArg(command='make p1')
     arg2 = shellsequence.ShellArg(command='')
     arg3 = shellsequence.ShellArg(command='deploy p1')
     self.setup_step(
         shellsequence.ShellSequence(commands=[arg1, arg2, arg3],
                                     workdir='build'))
     self.expect_commands(
         ExpectShell(workdir='build', command='make p1').exit(0),
         ExpectShell(workdir='build', command='deploy p1').exit(0))
     self.expect_outcome(result=SUCCESS, state_string="'deploy p1'")
     return self.run_step()
예제 #7
0
    def testSequenceStopsOnHaltOnFailure(self):
        arg1 = shellsequence.ShellArg(command='make p1', haltOnFailure=True)
        arg2 = shellsequence.ShellArg(command='deploy p1')

        self.setupStep(
            shellsequence.ShellSequence(commands=[arg1, arg2],
                                        workdir='build'))
        self.expectCommands(
            ExpectShell(
                workdir='build', command='make p1', usePTY="slave-config") + 1)
        self.expectOutcome(result=FAILURE, status_text=["'make", "p1'"])
        return self.runStep()
예제 #8
0
 def testSkipWorks(self):
     arg1 = shellsequence.ShellArg(command='make p1')
     arg2 = shellsequence.ShellArg(command='')
     arg3 = shellsequence.ShellArg(command='deploy p1')
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1, arg2, arg3],
                                     workdir='build'))
     self.expectCommands(ExpectShell(workdir='build', command='make p1',
                                     usePTY="slave-config") + 0,
                         ExpectShell(workdir='build', command='deploy p1',
                                     usePTY="slave-config") + 0)
     self.expectOutcome(result=SUCCESS, state_string="'deploy p1'")
     return self.runStep()
예제 #9
0
 def testMultipleCommandsAreRun(self):
     arg1 = shellsequence.ShellArg(command='make p1')
     arg2 = shellsequence.ShellArg(command='deploy p1', logfile='deploy')
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1, arg2],
                                     workdir='build'))
     self.expectCommands(ExpectShell(workdir='build', command='make p1',
                                     usePTY="slave-config") + 0,
                         ExpectShell(workdir='build', command='deploy p1',
                                     usePTY="slave-config") + 0 +
                         Expect.log('stdio deploy p1'))
     self.expectOutcome(result=SUCCESS, state_string="'deploy p1'")
     return self.runStep()
예제 #10
0
 def testShellArgsAreRendered(self):
     arg1 = shellsequence.ShellArg(
         command=WithProperties('make %s', 'project'),
         logfile=WithProperties('make %s', 'project'))
     self.setupStep(
         shellsequence.ShellSequence(commands=[arg1], workdir='build'))
     self.properties.setProperty("project", "BUILDBOT-TEST", "TEST")
     self.expectCommands(
         ExpectShell(workdir='build',
                     command='make BUILDBOT-TEST',
                     usePTY="slave-config") + 0 +
         Expect.log('stdio make BUILDBOT-TEST'))
     self.expectOutcome(result=SUCCESS,
                        status_text=["'make", "BUILDBOT-TEST'"])
     return self.runStep()