Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
Archivo: bash.py Proyecto: debris/kcov
    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
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
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
Ejemplo n.º 11
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
Ejemplo n.º 12
0
    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
Ejemplo n.º 13
0
Archivo: bash.py Proyecto: debris/kcov
    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")
Ejemplo n.º 14
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
Ejemplo n.º 15
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
Ejemplo n.º 16
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
Ejemplo n.º 17
0
    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
Ejemplo n.º 18
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
Ejemplo n.º 19
0
    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
Ejemplo n.º 20
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
Ejemplo n.º 21
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
Ejemplo n.º 22
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
Ejemplo n.º 23
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
Ejemplo n.º 24
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
Ejemplo n.º 25
0
    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")
Ejemplo n.º 26
0
    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
Ejemplo n.º 27
0
Archivo: bash.py Proyecto: debris/kcov
    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
Ejemplo n.º 28
0
    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
Ejemplo n.º 29
0
    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
Ejemplo n.º 30
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
Ejemplo n.º 31
0
    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
Ejemplo n.º 32
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
Ejemplo n.º 33
0
    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
Ejemplo n.º 34
0
    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
Ejemplo n.º 35
0
    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
Ejemplo n.º 36
0
    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
Ejemplo n.º 37
0
    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
Ejemplo n.º 38
0
    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
Ejemplo n.º 39
0
 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))
Ejemplo n.º 40
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
Ejemplo n.º 41
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
Ejemplo n.º 42
0
    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
Ejemplo n.º 43
0
    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
Ejemplo n.º 44
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
Ejemplo n.º 45
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
Ejemplo n.º 46
0
    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
Ejemplo n.º 47
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
Ejemplo n.º 48
0
    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
Ejemplo n.º 49
0
    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")
Ejemplo n.º 50
0
    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
Ejemplo n.º 51
0
 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))
Ejemplo n.º 52
0
    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
Ejemplo n.º 53
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", 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
Ejemplo n.º 54
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
Ejemplo n.º 55
0
    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
Ejemplo n.º 56
0
    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
Ejemplo n.º 57
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
Ejemplo n.º 58
0
    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
Ejemplo n.º 59
0
 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
Ejemplo n.º 60
0
    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