def setUp(self): # Uses gprof data, so make sure that the "loop" # program has been instrumented for gprof os.system("gcc -o loop test/testsource/loop.c -pg") # Make sure the gmon.out file is there self.profiledata = "test/testsource/gmon.out" self.failUnless(os.access(self.profiledata, os.R_OK)) self.runprog = which.which("gprof") self.failUnless(self.runprog is not None) self.args = "gprof ./loop".split() # Create a subdirectory to hold the log file dirname = "testcaptureprofilereporter" self.logfiledir = os.path.abspath(os.path.join(".", dirname)) os.mkdir(self.logfiledir)
def testProgNotInPath(self): self.assertEquals(which.which("foobarbaz"), None)
def testProgInPath(self): # This assumes /bin/sh is actually there self.assertEquals(which.which("sh"), "/bin/sh")