コード例 #1
0
    def test_dup_seg_names(self):
        """Not using a linker script will force adorn to generate
           segment names. In this case we should trigger the duplicate
           name detection code. Ensure the two 'rw' sections get
           renamed properly"""
        linker = "i686-unknown-linux-gnu-ld"
        has_linker = False
        for arg in test_args:
            if linker == arg[0][1]:
                has_linker = True

        if not has_linker:
            return

        expected_output = [
            'Segment    Name', '  00       rx', '  01       rw-SECTION_A',
            '  02       rw-02'
        ]
        adorn_main.main([
            "./run.py", "-o",
            os.path.join(out_dir, "ia32_gnu"), "--", linker, "-o",
            os.path.join(out_dir, "ia32_gnu"),
            os.path.join(obj_dir, "ia32_obj")
        ])
        print_args = ["-m", os.path.join(out_dir, "ia32_gnu")]
        exit_val, ret_stdout, ret_stderr = self._run_command(print_args)
        result = ret_stdout.split("\n")[1:5]
        self.assertEqual(expected_output, result)
コード例 #2
0
ファイル: test_elfadorn.py プロジェクト: BruceYi/okl4
    def test_dup_seg_names(self):
        """Not using a linker script will force adorn to generate
           segment names. In this case we should trigger the duplicate
           name detection code. Ensure the two 'rw' sections get
           renamed properly"""
        linker = "i686-unknown-linux-gnu-ld"
        has_linker = False
        for arg in test_args:
            if linker == arg[0][1]:
                has_linker = True

        if not has_linker:
            return

        expected_output = ['Segment    Name',
                           '  00       rx',
                           '  01       rw-SECTION_A',
                           '  02       rw-02']
        adorn_main.main([
            "./run.py",
            "-o",
            os.path.join(out_dir, "ia32_gnu"),
            "--",
            linker,
            "-o",
            os.path.join(out_dir, "ia32_gnu"),
            os.path.join(obj_dir, "ia32_obj")
            ])
        print_args = [ "-m", os.path.join(out_dir, "ia32_gnu")]
        exit_val, ret_stdout, ret_stderr = self._run_command(print_args)
        result = ret_stdout.split("\n")[1:5]
        self.assertEqual(expected_output, result)
コード例 #3
0
ファイル: elfadorn.py プロジェクト: openbox00/oktest
import sys
from traceback import print_exc

if "--traceback" in sys.argv:
    traceback = sys.argv.index("--traceback")
    del sys.argv[traceback]
else:
    traceback = 0

if sys.version_info[:3] == (2, 5, 0):
    print "Python version 2.5.0 is not supported due to a bug in the struct" \
          "module. Please upgrade to 2.5.1 or greater"
    sys.exit(1)

try:
    from adorn.main import main
    main(sys.argv)
except KeyboardInterrupt:
    pass
except SystemExit, exit_code:
    sys.exit(exit_code)
except:
    print "Elfadorn error:", sys.exc_info()[1]
    if traceback or True:
        print "Now printing a traceback."
        print
        print_exc(file=sys.stdout)
        print
    sys.exit(1)
コード例 #4
0
 def _run_adorn(self, args):
     args = self._cons_args(args)
     return adorn_main.main(args)
コード例 #5
0
ファイル: test_elfadorn.py プロジェクト: BruceYi/okl4
 def _run_adorn(self, args):
     args = self._cons_args(args)
     return adorn_main.main(args)