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.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.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): 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): 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/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() 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 + " --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 + " " + 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 + " " + 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() 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.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
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): 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 + "/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/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 + " --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): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/fork_no_wait", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/fork_no_wait", False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/fork_no_wait/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "fork-no-wait.c", 20) >= 1 assert parse_cobertura.hitsPerLine(dom, "fork-no-wait.c", 22) >= 1 assert parse_cobertura.hitsPerLine(dom, "fork-no-wait.c", 24) >= 1
def runTest(self): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/dlopen", False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/dlopen", False) assert noKcovRv == rv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/dlopen/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "dlopen.cc", 11) == 1 assert parse_cobertura.hitsPerLine(dom, "dlopen.cc", 12) == 0 assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "solib.c", 12) == 0
def doTest(self, binary): self.setUp() noKcovRv,o = self.do(testbase.testbuild + "/" + binary, False) rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/" + binary, False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/" + binary + "/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "fork.c", 21) == 0 assert parse_cobertura.hitsPerLine(dom, "fork.c", 26) >= 1 assert parse_cobertura.hitsPerLine(dom, "fork.c", 34) >= 1 assert parse_cobertura.hitsPerLine(dom, "fork.c", 37) >= 1 assert parse_cobertura.hitsPerLine(dom, "fork.c", 46) >= 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
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/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 + " " + 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() 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 " + 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() 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): 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() 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() 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", 34) == 2
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() os.environ["PATH"] += testbase.sources + "/tests/python" noKcovRv,o = self.do(testbase.sources + "/tests/python/main 5") rv,o = self.do(testbase.kcov + " " + testbase.outbase + "/kcov " + "main 5") dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "second.py", 34) == 2 assert noKcovRv, rv
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 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/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 + "/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): 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() 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.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 + " " + 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() 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): 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): dom = self.doTest("") assert parse_cobertura.hitsPerLine(dom, "shell-main", 77) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 83) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 88) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 93) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 109) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 118) == 1
def runTest(self): dom = self.doTest("5") assert parse_cobertura.hitsPerLine(dom, "shell-main", 52) == 4 assert parse_cobertura.hitsPerLine(dom, "shell-main", 53) == None assert parse_cobertura.hitsPerLine(dom, "shell-main", 55) == None assert parse_cobertura.hitsPerLine(dom, "shell-main", 59) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 61) == None assert parse_cobertura.hitsPerLine(dom, "shell-main", 62) == None
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 + " " + testbase.outbase + "/kcov/third " + testbase.sources + "/tests/bash/dollar-var-replacements.sh") rv, o = self.do(testbase.kcov + " --merge " + testbase.outbase + "/kcov/merged " + testbase.outbase + "/kcov/first " + testbase.outbase + "/kcov/second") rv, o = self.do(testbase.kcov + " --merge " + testbase.outbase + "/kcov/merged2 " + testbase.outbase + "/kcov/merged " + testbase.outbase + "/kcov/third") dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/merged2/kcov-merged/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 10) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 4) == 1 assert parse_cobertura.hitsPerLine(dom, "dollar-var-replacements.sh", 2) == 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") 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 + " --clean "+ 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 assert parse_cobertura.hitsPerLine(dom, "main", 14) == 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") 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() os.system("cp %s/tests/short-file.c %s/main.cc" % (testbase.sources, testbase.testbuild)) os.system("gcc -g -o %s/main-collect-only %s/main.cc" % (testbase.testbuild, testbase.testbuild)) os.system("mv %s/main.cc %s/tmp-main.cc" % (testbase.testbuild, testbase.testbuild)) rv, o = self.do( testbase.kcov + " --collect-only " + testbase.outbase + "/kcov " + testbase.testbuild + "/main-collect-only", False) os.system("mv %s/tmp-main.cc %s/main.cc" % (testbase.testbuild, testbase.testbuild)) rv, o = self.do(testbase.kcov + " --report-only " + testbase.outbase + "/kcov " + testbase.testbuild + "/main-collect-only") dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/main-collect-only/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 1) == 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, verify): self.setUp() noKcovRv, o = self.do(testbase.testbuild + "/main-tests", False) rv, o = self.do( testbase.kcov + " " + verify + " " + testbase.outbase + "/kcov " + testbase.testbuild + "/main-tests 5", False) assert rv == noKcovRv dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/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 assert parse_cobertura.hitsPerLine(dom, "main.cc", 25) == 1 assert parse_cobertura.hitsPerLine(dom, "file.c", 6) == 1 assert parse_cobertura.hitsPerLine(dom, "file2.c", 7) == 0
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 doTest(self): self.setUp() dom = self.cmpOne("hup") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 14) == 1 dom = self.cmpOne("int") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 19) == 1 dom = self.cmpOne("quit") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 24) == 1 dom = self.cmpOne("bus") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 44) == 1 dom = self.cmpOne("fpe") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 49) == 1 dom = self.cmpOne("term") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 84) == 1
def runTest(self): self.setUp() dom = self.cmpOne("hup") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 14) == 1 dom = self.cmpOne("int") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 19) == 1 dom = self.cmpOne("quit") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 24) == 1 dom = self.cmpOne("abrt") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 39) == 1 dom = self.cmpOne("segv") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 64) == 1 dom = self.cmpOne("term") assert parse_cobertura.hitsPerLine(dom, "test-signals.c", 84) == 1
def runTest(self): self.setUp() if (not os.path.isfile(testbase.testbuild + "/sanitizer-coverage")): print "Clang-only" return True rv, o = self.do( testbase.kcov + " --clang " + testbase.outbase + "/kcov " + testbase.testbuild + "/sanitizer-coverage", False) dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/sanitizer-coverage/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 7) == 1 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 8) == 1 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 16) == 1 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 18) == 1 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 22) == 0 assert parse_cobertura.hitsPerLine(dom, "sanitizer-coverage.c", 25) == 0
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): dom = self.doTest("") assert parse_cobertura.hitsPerLine(dom, "shell-main", 102) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 103) == 3