Beispiel #1
0
    def do_test(self, insert):
        conn = make_database(insert)

        try:
            files, inputs, outputs = get_files(conn)
            files = set(fi for fi in files
                        if not fi.path.path.startswith(b'/lib'))
            return files, inputs, outputs
        finally:
            conn.close()
Beispiel #2
0
    def do_test(self, insert):
        conn = make_database(insert)

        try:
            files, inputs, outputs = get_files(conn)
            files = set(fi for fi in files
                        if not fi.path.path.startswith(b'/lib'))
            return files, inputs, outputs
        finally:
            conn.close()
Beispiel #3
0
    def setUpClass(cls):
        cls._trace = Path.tempdir(prefix='rpz_testdb_')
        conn = make_database([
            ('proc', 0, None, False),
            ('open', 0, "/some/dir", True, FILE_WDIR),
            ('exec', 0, "/bin/sh", "/some/dir", "sh\0script_1\0"),
            ('open', 0, "/usr/share/1_one.pyc", False, FILE_READ),
            ('open', 0, "/some/dir/one", False, FILE_WRITE),
            ('exec', 0, "/usr/bin/python", "/some/dir", "python\0drive.py\0"),
            ('open', 0, "/some/dir/drive.py", False, FILE_READ),
            ('open', 0, "/some/dir/one", False, FILE_READ),
            ('open', 0, "/etc/2_two.cfg", False, FILE_READ),
            ('proc', 1, 0, False),
            ('open', 1, "/some/dir", True, FILE_WDIR),
            ('exec', 1, "/some/dir/experiment", "/some/dir", "experiment\0"),
            ('open', 1, "/some/dir/one", False, FILE_STAT),
            ('open', 1, "/usr/lib/2_one.so", False, FILE_READ),
            ('open', 1, "/some/dir/two", False, FILE_WRITE),
            ('exec', 0, "/usr/bin/wc", "/some/dir", "wc\0out.txt\0"),
            ('exit', 1),
            ('open', 0, "/some/dir/two", False, FILE_READ),
            ('exit', 0),
            ('proc', 2, None, False),
            ('open', 2, "/some/dir", True, FILE_WDIR),
            ('exec', 2, "/bin/sh", "/some/dir", "sh\0script_2\0"),
            ('proc', 3, 2, True),
            ('exit', 3),
            ('proc', 4, 2, False),
            ('open', 4, "/some/dir", True, FILE_WDIR),
            ('exec', 4, "/usr/bin/python", "/some/dir", "python\0-\0"),
            ('open', 4, "/some/dir/one", False, FILE_READ),
            ('open', 4, "/some/dir/thing", False, FILE_WRITE),
            ('exec', 2, "/some/dir/report", "/some/dir", "./report\0-v\0"),
            ('open', 2, "/some/dir/thing", False, FILE_READ),
            ('exit', 4),
            ('open', 2, "/some/dir/result", False, FILE_WRITE),
            ('exit', 2),
        ], cls._trace / 'trace.sqlite3')
        conn.close()
        with (cls._trace / 'config.yml').open('w', encoding='utf-8') as fp:
            fp.write("""\
version: "1.1"
runs:
- id: first run
  architecture: x86_64
  argv: [sh, "script_1"]
  binary: /some/dir/one
  distribution: [debian, '8.0']
  environ: {USER: remram}
  exitcode: 0
  uid: 1000
  gid: 1000
  hostname: test
  workingdir: /user/dir
- architecture: x86_64
  argv: ["sh", "script_2"]
  binary: /some/dir/one
  distribution: [debian, '8.0']
  environ: {USER: remram}
  exitcode: 0
  uid: 1000
  gid: 1000
  hostname: test
  workingdir: /user/dir

inputs_outputs:
- name: important
  path: "/some/dir/one"
  written_by_runs: [0]
  read_by_runs: [1]

packages:
- name: pkg1
  version: "1.0"
  size: 10000
  packfiles: true
  files:
  - "/usr/share/1_one.py"
  - "/usr/share/1_two.py"
  - "/usr/bin/wc"
- name: pkg2
  version: "1.0"
  size: 10000
  packfiles: true
  files:
  - "/usr/lib/2_one.so"
  - "/etc/2_two.cfg"
  meta: {"section": "libs"}
- name: python
  version: "2.7"
  size: 5000000
  packfiles: true
  files:
  - "/usr/bin/python"
  meta: {"section": "python"}
- name: unused
  version: "0.1"
  size: 100
  packfiles: true
  files:
  - "/an/unused/file"

other_files:
- "/bin/sh"
- "/usr/share/1_one.pyc"
- "/some/dir/drive.py"
- "/some/dir/experiment"
- "/some/dir/report"
""")
Beispiel #4
0
    def setUpClass(cls):
        if sys.version_info < (2, 7, 3):
            raise unittest.SkipTest("Python version not supported by reprozip")

        cls._trace = Path.tempdir(prefix='rpz_testdb_')
        conn = make_database([
            ('proc', 0, None, False),
            ('open', 0, "/some/dir", True, FILE_WDIR),
            ('exec', 0, "/bin/sh", "/some/dir", "sh\0script_1\0"),
            ('open', 0, "/usr/share/1_one.pyc", False, FILE_READ),
            ('open', 0, "/some/dir/one", False, FILE_WRITE),
            ('exec', 0, "/usr/bin/python", "/some/dir", "python\0drive.py\0"),
            ('open', 0, "/some/dir/drive.py", False, FILE_READ),
            ('open', 0, "/some/dir/one", False, FILE_READ),
            ('open', 0, "/etc/2_two.cfg", False, FILE_READ),
            ('proc', 1, 0, False),
            ('open', 1, "/some/dir", True, FILE_WDIR),
            ('exec', 1, "/some/dir/experiment", "/some/dir", "experiment\0"),
            ('open', 1, "/some/dir/one", False, FILE_STAT),
            ('open', 1, "/usr/lib/2_one.so", False, FILE_READ),
            ('open', 1, "/some/dir/two", False, FILE_WRITE),
            ('exec', 0, "/usr/bin/wc", "/some/dir", "wc\0out.txt\0"),
            ('exit', 1),
            ('open', 0, "/some/dir/two", False, FILE_READ),
            ('exit', 0),

            ('proc', 2, None, False),
            ('open', 2, "/some/dir", True, FILE_WDIR),
            ('exec', 2, "/bin/sh", "/some/dir", "sh\0script_2\0"),
            ('proc', 3, 2, True),
            ('exit', 3),
            ('proc', 4, 2, False),
            ('open', 4, "/some/dir", True, FILE_WDIR),
            ('exec', 4, "/usr/bin/python", "/some/dir", "python\0-\0"),
            ('open', 4, "/some/dir/one", False, FILE_READ),
            ('open', 4, "/some/dir/thing", False, FILE_WRITE),
            ('exec', 2, "/some/dir/report", "/some/dir", "./report\0-v\0"),
            ('open', 2, "/some/dir/thing", False, FILE_READ),
            ('exit', 4),
            ('open', 2, "/some/dir/result", False, FILE_WRITE),
            ('exit', 2),
        ], cls._trace / 'trace.sqlite3')
        conn.close()
        with (cls._trace / 'config.yml').open('w', encoding='utf-8') as fp:
            fp.write("""\
version: "1.1"
runs:
- id: first run
  architecture: x86_64
  argv: [sh, "script_1"]
  binary: /some/dir/one
  distribution: [debian, '8.0']
  environ: {USER: remram}
  exitcode: 0
  uid: 1000
  gid: 1000
  hostname: test
  workingdir: /user/dir
- architecture: x86_64
  argv: ["sh", "script_2"]
  binary: /some/dir/one
  distribution: [debian, '8.0']
  environ: {USER: remram}
  exitcode: 0
  uid: 1000
  gid: 1000
  hostname: test
  workingdir: /user/dir

inputs_outputs:
- name: important
  path: "/some/dir/one"
  written_by_runs: [0]
  read_by_runs: [1]

packages:
- name: pkg1
  version: "1.0"
  size: 10000
  packfiles: true
  files:
  - "/usr/share/1_one.py"
  - "/usr/share/1_two.py"
  - "/usr/bin/wc"
- name: pkg2
  version: "1.0"
  size: 10000
  packfiles: true
  files:
  - "/usr/lib/2_one.so"
  - "/etc/2_two.cfg"
  meta: {"section": "libs"}
- name: python
  version: "2.7"
  size: 5000000
  packfiles: true
  files:
  - "/usr/bin/python"
  meta: {"section": "python"}
- name: unused
  version: "0.1"
  size: 100
  packfiles: true
  files:
  - "/an/unused/file"

other_files:
- "/bin/sh"
- "/usr/share/1_one.pyc"
- "/some/dir/drive.py"
- "/some/dir/experiment"
- "/some/dir/report"
""")