def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh 1") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 16) == 0 rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh 2") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 16) == 1 rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh all") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 36) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 30) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 33) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 36) == 1
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " --bash-dont-parse-binary-dir --exclude-pattern=first-dir " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) >= 1 assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None rv, o = self.do(testbase.kcov + " --include-pattern=first-dir " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) >= 1 rv, o = self.do( testbase.kcov + " --include-pattern=first-dir --exclude-pattern=c.sh " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) >= 1
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_1", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/multi_1/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main_1.c", 10) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_2", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main_2.c", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 8) == 0 rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_2 1", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 8) == 1
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh 1" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 16) == 0 rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh 2" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 16) == 1 rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/unitundertest.sh all" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/unitundertest.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 36) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 30) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 33) == 1 assert parse_cobertura.hitsPerLine(dom, "unitundertest.sh", 36) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 16) == 0 assert parse_cobertura.hitsPerLine(dom, "main", 19) == 1 rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 16) == 1 assert parse_cobertura.hitsPerLine(dom, "main", 19) == 1
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/test_daemon", False) rv,o = self.do(testbase.kcov + " --output-interval=1 --exit-first-process " + testbase.outbase + "/kcov " + testbase.testbuild + "/test_daemon", False) assert noKcovRv == rv time.sleep(2) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/test_daemon/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-daemon.cc", 31) == 0 time.sleep(5) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/test_daemon/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-daemon.cc", 31) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 16) == 1 assert parse_cobertura.hitsPerLine(dom, "main", 19) == 0 assert parse_cobertura.hitsPerLine(dom, "main", 14) == 1 rv,o = self.do(testbase.kcov + " "+ testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 16) == 1 assert parse_cobertura.hitsPerLine(dom, "main", 19) == 1 assert parse_cobertura.hitsPerLine(dom, "main", 14) == 2
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") self.failIf(parse_cobertura.hitsPerLine(dom, "main", 16) != 1) self.failIf(parse_cobertura.hitsPerLine(dom, "main", 19) != 0) self.failIf(parse_cobertura.hitsPerLine(dom, "main", 14) != 1) rv,o = self.do(testbase.kcov + " "+ testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") self.failIf(parse_cobertura.hitsPerLine(dom, "main", 16) != 1) self.failIf(parse_cobertura.hitsPerLine(dom, "main", 19) != 1) self.failIf(parse_cobertura.hitsPerLine(dom, "main", 14) != 2)
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/pie-test", False) assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/pie-test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "argv-dependent.c", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "argv-dependent.c", 11) == 0 rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/pie-test a", False) assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/pie-test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "argv-dependent.c", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "argv-dependent.c", 11) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/multiline-alias.sh") assert o.find("echo called test_alias") == -1 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/multiline-alias.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "multiline-alias.sh", 6) == 1
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/main-tests ", False) rv,o = self.do(testbase.kcov + " --collect-only " + testbase.outbase + "/kcov " + testbase.testbuild + "/main-tests", False) assert rv == noKcovRv try: dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main-tests/cobertura.xml") self.fail("File unexpectedly found") except: # Exception is expected here pass rv,o = self.do(testbase.kcov + " --report-only " + testbase.outbase + "/kcov " + testbase.testbuild + "/main-tests", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main-tests/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == 1
def doTest(self, args): self.setUp() rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main " + args ) return parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml")
def runTest(self): self.setUp() rv,o = self.do(testbase.sources + "/tests/daemon/test-script.sh " + testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/issue31", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/issue31/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-issue31.cc", 28) >= 1 assert parse_cobertura.hitsPerLine(dom, "test-issue31.cc", 11) >= 1 assert parse_cobertura.hitsPerLine(dom, "test-issue31.cc", 8) == 0
def runTest(self): print(platform.machine()) self.setUp() try: os.makedirs(testbase.outbase + "/kcov") except: pass rv,o = self.do(testbase.kcov + " --system-record " + testbase.outbase + "/kcov " + testbase.testbuild + "/") rv,o = self.do(testbase.kcov_system_daemon + " -d", False) os.environ["LD_LIBRARY_PATH"] = testbase.outbase + "/kcov/lib" rv,o = self.do(testbase.outbase + "/kcov/main-tests", False) assert rv == 0 time.sleep(3) self.writeToPipe("STOPME") rv,o = self.do(testbase.kcov + " --system-report " + testbase.outbase + "/kcov-report /tmp/kcov-data") assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov-report/main-tests/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) == None assert parse_cobertura.hitsPerLine(dom, "main.cc", 18) >= 1
def runTest(self): print platform.machine() self.setUp() try: os.makedirs(testbase.outbase + "/kcov") except: pass rv,o = self.do(testbase.kcov + " --system-record " + testbase.outbase + "/kcov " + testbase.testbuild + "/") rv,o = self.do(testbase.kcov_system_daemon + " -d", False) os.environ["LD_LIBRARY_PATH"] = testbase.outbase + "/kcov/lib" rv,o = self.do(testbase.outbase + "/kcov/main-tests", False) assert rv == 0 time.sleep(3) self.writeToPipe("STOPME") rv,o = self.do(testbase.kcov + " --system-report " + testbase.outbase + "/kcov-report /tmp/kcov-data") assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov-report/main-tests/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) == None assert parse_cobertura.hitsPerLine(dom, "main.cc", 18) >= 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/no-executed-statements.sh") assert o.find("echo called test_alias") == -1 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/no-executed-statements.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "no-executed-statements.sh", 4) == 0
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --exclude-pattern=dlopen.cc " + testbase.outbase + "/kcov " + testbase.testbuild + "/dlopen", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/dlopen/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "dlopen-main.cc", 10) == 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 12) == 0
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 180) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/subshell.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/subshell.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 1) == None assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 4) == 2 assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 8) == None
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --exclude-region=CUSTOM_RANGE_START:CUSTOM_RANGE_END " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/other.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/other.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "other.sh", 22) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 23) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 26) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 27) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 28) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 29) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 32) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 34) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 35) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 36) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 37) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 40) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 42) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 43) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 47) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 48) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 49) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 51) == 1
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " --exclude-region=CUSTOM_RANGE_START:CUSTOM_RANGE_END " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/other.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/other.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "other.sh", 22) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 23) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 26) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 27) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 28) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 29) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 32) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 34) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 35) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 36) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 37) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 40) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 42) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 43) == 1 assert parse_cobertura.hitsPerLine(dom, "other.sh", 47) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 48) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 49) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 51) == 1
def doTest(self, args): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main " + args) return parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml")
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --bash-dont-parse-binary-dir --include-path=" + testbase.sources + "/tests/bash/first-dir --exclude-pattern=b.sh " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) >= 1 assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) == None
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/short-test.sh" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/short-test.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "short-test.sh", 5) == 11
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/unittest/testdriver") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/testdriver/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "testdriver", 14) == 1
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/short-test.py") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/short-test.py/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "short-test.py", 6) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov/first " + testbase.sources + "/tests/python/main 5") rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov/second " + testbase.sources + "/tests/bash/shell-main") rv,o = self.do(testbase.kcov + " --merge " + testbase.outbase + "/kcov/merged " + testbase.outbase + "/kcov/first " + testbase.outbase + "/kcov/second") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/merged/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 10) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 4) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --bash-parse-files-in-dir=" + testbase.sources + "/tests/bash " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/first-dir/a.sh 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/a.sh/cobertura.xml") # Not executed assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == 0 assert parse_cobertura.hitsPerLine(dom, "other.sh", 3) == 0
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --bash-method=DEBUG " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 3) == None assert parse_cobertura.hitsPerLine(dom, "shell-main", 4) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 22) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/dollar-var-replacements.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/dollar-var-replacements.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "dollar-var-replacements.sh", 2) == 1 assert parse_cobertura.hitsPerLine(dom, "dollar-var-replacements.sh", 4) == 1 assert parse_cobertura.hitsPerLine(dom, "dollar-var-replacements.sh", 5) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --exclude-pattern=solib " + testbase.outbase + "/kcov " + testbase.testbuild + "/shared_library_test", False) assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shared_library_test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.c", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == None
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/global-constructors", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/global-constructors", False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/global-constructors/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-global-ctors.cc", 4) >= 1
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/pie", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/pie", False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/pie/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "pie.c", 5) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_1", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/multi_1/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main_1.c", 10) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_2", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main_2.c", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 8) == 0 rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/multi_2 1", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "file.c", 3) == 0 assert parse_cobertura.hitsPerLine(dom, "file.c", 8) == 1
def runTest(self): rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/subshell.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/subshell.sh/cobertura.xml") self.assertIsNone(parse_cobertura.hitsPerLine(dom, "subshell.sh", 1)) self.assertEqual(2, parse_cobertura.hitsPerLine(dom, "subshell.sh", 4)) self.assertEqual(0, parse_cobertura.hitsPerLine(dom, "subshell.sh", 8))
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/vfork", False) assert rv == 0 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/vfork/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "vfork.c", 12) >= 1 assert parse_cobertura.hitsPerLine(dom, "vfork.c", 18) >= 1
def runTest(self): self.setUp() os.system("mkdir -p /tmp/test-kcov") os.system("cp " + testbase.sources + "/tests/bash/shell-main /tmp/test-kcov") os.system("cp " + testbase.sources + "/tests/bash/other.sh /tmp/test-kcov") rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov /tmp/test-kcov/shell-main 5 9") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 40) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 67) == 2 assert parse_cobertura.hitsPerLine(dom, "other.sh", 6) == 2 os.system("echo \"echo 'arne-anka'\" >> /tmp/test-kcov/shell-main") rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov /tmp/test-kcov/shell-main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 40) == 0 assert parse_cobertura.hitsPerLine(dom, "shell-main", 67) == 0 assert parse_cobertura.hitsPerLine(dom, "other.sh", 6) == 3
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " --bash-dont-parse-binary-dir " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/first-dir/a.sh 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/a.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "a.sh", 5) == 1 # Not included in report assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None assert parse_cobertura.hitsPerLine(dom, "other.sh", 3) == None
def runTest(self): rv,o = self.do(testbase.kcov + " --bash-dont-parse-binary-dir " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/function-with-spaces.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/function-with-spaces.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 5) == None assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 9) == None assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 10) == None assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 11) == 1
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " --bash-handle-sh-invocation " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "sh-shebang.sh", 4) == 1
def cmpOne(self, sig): noKcovRv, o = self.do(testbase.testbuild + "/signals " + sig, False) rv, o = self.do( testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/signals " + sig, False) assert rv == noKcovRv return parse_cobertura.parseFile(testbase.outbase + "/kcov/signals/cobertura.xml")
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/test_daemon", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/test_daemon", False) assert rv == 4 assert noKcovRv == 2 dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/test_daemon/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-daemon.cc", 31) == 1
def runTest(self): script = "handle-all-output.sh" rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/" + script, timeout=5.0) self.assertEqual(0, rv, "kcov exited unsuccessfully") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/" + script + "/cobertura.xml") self.assertIsNone(parse_cobertura.hitsPerLine(dom, script, 1)) self.assertEqual(1000, parse_cobertura.hitsPerLine(dom, script, 4))
def runTest(self): self.setUp() noKcovRv, o = self.do(testbase.testbuild + "/test_daemon", False) rv, o = self.do( testbase.kcov + " --output-interval=1 --exit-first-process " + testbase.outbase + "/kcov " + testbase.testbuild + "/test_daemon", False) assert noKcovRv == rv time.sleep(2) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/test_daemon/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-daemon.cc", 31) == 0 time.sleep(5) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/test_daemon/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "test-daemon.cc", 31) == 1
def runTest(self): self.setUp() rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/shell-main") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 142) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 149) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 151) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 152) == 1
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/subshell.sh") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/subshell.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 1) == None assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 4) == 2 assert parse_cobertura.hitsPerLine(dom, "subshell.sh", 8) == None
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/shared_library_test", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/shared_library_test", False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shared_library_test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.c", 9) >= 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == 1
def runTest(self): self.setUp() rv, o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/python/main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "second.py", 57) == 1 assert parse_cobertura.hitsPerLine(dom, "second.py", 61) == 1
def runTest(self): self.setUp() rv, o = self.do( testbase.sources + "/tests/setpgid-kill/test-script.sh " + testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.sources + "/tests/bash/trap.sh", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/trap.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "trap.sh", 5) == 1
def runTest(self): self.setUp() rv, o = self.do( testbase.sources + "/tests/daemon/test-script.sh " + testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/thread-test", False) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/thread-test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "thread-main.c", 21) >= 1 assert parse_cobertura.hitsPerLine(dom, "thread-main.c", 9) >= 1
def runTest(self): self.setUp() rv, o = self.do( testbase.kcov + " --skip-solibs " + testbase.outbase + "/kcov " + testbase.testbuild + "/shared_library_test", False) assert rv == 0 dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/shared_library_test/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.c", 9) == 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == None