コード例 #1
0
ファイル: example_prog.py プロジェクト: ChrisCummins/phd
    def setup(self):
        """
        Testcase setup.

        To setup a test case, we need to checkout the correct git
        branch, set the optimisation level, and build the program.
        """
        const = self.invars["const"]
        olevel = self.invars["Olevel"]

        # Checkout correct source.
        if const:
            git.checkout("master")
        else:
            git.checkout("no-const")

        # Set Olevel
        system.sed("(^OPTIMISATION_LEVEL = ).*", "\\1{}" % olevel, "Makefile")

        # Build project.
        make.clean()
        make.target("./examples/example1")
コード例 #2
0
ファイル: test_system.py プロジェクト: ChrisCummins/phd
 def test_sed(self):
     system.echo("Hello, world!", "/tmp/labm8.tmp")
     system.sed("Hello", "Goodbye", "/tmp/labm8.tmp")
     self._test(["Goodbye, world!"], fs.read("/tmp/labm8.tmp"))
     system.sed("o", "_", "/tmp/labm8.tmp")
     self._test(["G_odbye, world!"], fs.read("/tmp/labm8.tmp"))
     system.sed("o", "_", "/tmp/labm8.tmp", "g")
     self._test(["G__dbye, w_rld!"], fs.read("/tmp/labm8.tmp"))
コード例 #3
0
ファイル: system_test.py プロジェクト: 50417/DeepFuzzSL
def test_sed():
  system.echo("Hello, world!", "/tmp/labm8.tmp")
  system.sed("Hello", "Goodbye", "/tmp/labm8.tmp")
  assert ["Goodbye, world!"] == fs.read("/tmp/labm8.tmp")
  system.sed("o", "_", "/tmp/labm8.tmp")
  assert ["G_odbye, world!"] == fs.read("/tmp/labm8.tmp")
  system.sed("o", "_", "/tmp/labm8.tmp", "g")
  assert ["G__dbye, w_rld!"] == fs.read("/tmp/labm8.tmp")
コード例 #4
0
ファイル: example_prog2.py プロジェクト: ChrisCummins/phd
    def setup(self):
        """
        Testcase setup.

        Set the correct border size, then build the benchmark.
        """
        border = self.invars["border"]

        # Set the border size.
        system.sed("(define NORTH) [0-9]+", "\\1 {}" % border[0],
                   self.SRC)
        system.sed("(define WEST) [0-9]+", "\\1 {}" % border[1],
                   self.SRC)
        system.sed("(define SOUTH) [0-9]+", "\\1 {}" % border[2],
                   self.SRC)
        system.sed("(define EAST) [0-9]+", "\\1 {}" % border[3],
                   self.SRC)

        # Build benchmark.
        fs.cd(BUILD_ROOT)
        make.clean()
        make.target("SimpleBig")
コード例 #5
0
ファイル: system_test.py プロジェクト: 50417/DeepFuzzSL
def test_sed_fail_no_file():
  with pytest.raises(system.SubprocessError):
    system.sed("Hello", "Goodbye", "/not/a/real/file")