python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
#!/usr/bin/env python3 import shutil, sys, subprocess, argparse, pathlib import platform parser = argparse.ArgumentParser() parser.add_argument('--private-dir', required=True) parser.add_argument('-o', required=True) parser.add_argument('cmparr', nargs='+') contents = '''#include<stdio.h> void flob(void) { pri...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/208 link custom/custom_stlib.py
#!/usr/bin/env python3 import shutil, sys if __name__ == '__main__': shutil.copyfile(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/208 link custom/custom_target.py
#!/usr/bin/env python3 # NOTE: this file does not have the executable bit set. This tests that # Meson can automatically parse shebang lines. import sys template = '#define RET_VAL %s\n' with open(sys.argv[1]) as f: output = template % (f.readline().strip(), ) with open(sys.argv[2], 'w') as f: f.write(output...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/57 custom header generator/makeheader.py
#!/usr/bin/env python3 if __name__ == '__main__': pass
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/83 identical target name in subproject/true.py
#!/usr/bin/env python3 if __name__ == '__main__': pass
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/83 identical target name in subproject/subprojects/foo/true.py
#!/usr/bin/env python3 import sys if len(sys.argv) != 2 or sys.argv[1] != '--version': exit(1) print('Version: 1.0')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/26 find program/print-version-with-prefix.py
#!/usr/bin/env python3 import sys if len(sys.argv) != 2 or sys.argv[1] != '--version': exit(1) print('1.0')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/26 find program/print-version.py
#!/usr/bin/env python3 exit(0)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/26 find program/scripts/test_subdir.py
#!/usr/bin/env python3 # Mimic a binary that generates an object file (e.g. windres). import sys, subprocess if __name__ == '__main__': if len(sys.argv) != 4: print(sys.argv[0], 'compiler input_file output_file') sys.exit(1) compiler = sys.argv[1] ifile = sys.argv[2] ofile = sys.argv[...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/121 object only target/obj_generator.py
#!/usr/bin/env python3 import os import sys out = sys.argv[1] try: os.mkdir(out) except FileExistsError: pass for name in ('a', 'b', 'c'): with open(os.path.join(out, name + '.html'), 'w') as f: f.write(name)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/123 custom target directory install/docgen.py
#!/usr/bin/env python3 import os import os.path import sys def main(): name = os.path.splitext(os.path.basename(sys.argv[1]))[0] out = sys.argv[2] hname = os.path.join(out, name + '.h') cname = os.path.join(out, name + '.c') print(os.getcwd(), hname) with open(hname, 'w') as hfile: hf...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/170 generator link whole/generator.py
#!/usr/bin/env python3 from pathlib import Path import sys if __name__ == '__main__': Path(sys.argv[1]).write_text('Hello World\n') raise SystemExit(0)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/178 bothlibraries/dummy.py
#!/usr/bin/env python3 import sys import argparse parser = argparse.ArgumentParser() parser.add_argument('input', help='the input file') options = parser.parse_args(sys.argv[1:]) with open(options.input) as f: content = f.read().strip() print(content)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/90 gen extra/srcgen3.py
#!/usr/bin/env python3 import os import sys import argparse parser = argparse.ArgumentParser() parser.add_argument('target_dir', help='the target dir') parser.add_argument('stem', help='the stem') parser.add_argument('input', help='the input file') options ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/90 gen extra/srcgen2.py
#!/usr/bin/env python3 import sys import argparse parser = argparse.ArgumentParser() parser.add_argument('--input', dest='input', help='the input file') parser.add_argument('--output', dest='output', help='the output file') parser.add_argument('--upper', dest='upper', action='s...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/90 gen extra/srcgen.py
#!/usr/bin/env python3 import sys if sys.argv[1] == 'correct': print('Argument is correct.') sys.exit(0) print('Argument is incorrect:', sys.argv[1]) sys.exit(1)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/70 external test program/mytest.py
#!/usr/bin/env python3 import sys import shutil shutil.copyfile(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/127 generated assembly/copyfile.py
#!/usr/bin/env python3 import sys, os if len(sys.argv) != 2: print(sys.argv[0], '<output dir>') odir = sys.argv[1] with open(os.path.join(odir, 'mylib.h'), 'w') as f: f.write('int func(void);\n') with open(os.path.join(odir, 'mylib.c'), 'w') as f: f.write('''int func(void) { return 0; } ''')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/54 custom target source output/generator.py
#!/usr/bin/env python3 import sys if __name__ == '__main__': if len(sys.argv) != 3: print(sys.argv[0], 'input_file output_file') sys.exit(1) with open(sys.argv[1]) as f: ifile = f.read() if ifile != 'This is a text only input file.\n': print('Malformed input') sys.e...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/50 custom target chain/my_compiler.py
#!/usr/bin/env python3 import sys if __name__ == '__main__': if len(sys.argv) != 3: print(sys.argv[0], 'input_file output_file') sys.exit(1) with open(sys.argv[1]) as f: ifile = f.read() if ifile != 'This is a binary output file.\n': print('Malformed input') sys.exi...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/50 custom target chain/my_compiler2.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'rb') as ifile: with open(sys.argv[2], 'w') as ofile: ofile.write('Everything ok.\n')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/50 custom target chain/usetarget/subcomp.py
#!/usr/bin/env python3 import sys import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('file', nargs=1, type=str) parser.add_argument('text', nargs=1, type=str) args = parser.parse_args() text = args.text[0] with open(args.file[0], encoding='utf-8') as f: ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/file_contains.py
#!/usr/bin/env python3 import sys, os from pathlib import Path if len(sys.argv) != 3: print("Wrong amount of parameters.") build_dir = Path(os.environ['MESON_BUILD_ROOT']) subdir = Path(os.environ['MESON_SUBDIR']) inputf = Path(sys.argv[1]) outputf = Path(sys.argv[2]) assert(inputf.exists()) with outputf.open(...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/generator.py
#!/usr/bin/env python3 import sys import argparse import os def main(): parser = argparse.ArgumentParser() parser.add_argument('text', nargs='*', type=str) args = parser.parse_args() text = args.text if isinstance(args.text, list) else [args.text] output = '' for t in text: t = os.pa...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/basename.py
#!/usr/bin/env python3 import sys import argparse from pathlib import Path def main(): parser = argparse.ArgumentParser() parser.add_argument('files', nargs='*', type=str) args = parser.parse_args() for filepath in args.files: Path(filepath).touch() if __name__ == '__main__': sys.exit(ma...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/touch.py
#!/usr/bin/env python3 import sys, os from pathlib import Path if len(sys.argv) != 3: print("Wrong amount of parameters.") build_dir = Path(os.environ['MESON_BUILD_ROOT']) subdir = Path(os.environ['MESON_SUBDIR']) outputf = Path(sys.argv[1]) with outputf.open('w') as ofile: ofile.write("#define ZERO_RESULT ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/generator-deps.py
#!/usr/bin/env python3 import sys, os from pathlib import Path if len(sys.argv) != 2: print("Wrong amount of parameters.") build_dir = Path(os.environ['MESON_BUILD_ROOT']) subdir = Path(os.environ['MESON_SUBDIR']) outputf = Path(sys.argv[1]) with outputf.open('w') as ofile: ofile.write("#define ZERO_RESULT ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/generator-without-input-file.py
#!/usr/bin/env python3 import os import sys def permit_osx_workaround(m1, m2): import platform if platform.system().lower() != 'darwin': return False if m2 % 10000 != 0: return False if m1//10000 != m2//10000: return False return True if len(sys.argv) == 2: assert(os....
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/check_file.py
#!/usr/bin/env python3 import sys from pathlib import Path files = [Path(f) for f in sys.argv[1:]] names = [f.name for f in files] assert names == ['check_inputs.txt', 'prog.c', 'prog.c', 'prog2.c', 'prog4.c', 'prog5.c'] for f in files[1:]: assert f.exists() with files[0].open('w') as ofile: ofile.write("#d...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/14 configure file/check_inputs.py
#!/usr/bin/env python3 import sys data = open(sys.argv[1], 'rb').read()
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/92 test workdir/subdir/checker.py
#! /usr/bin/env python3 import json import sys import os cc = None output = None # Only the ninja backend produces compile_commands.json if sys.argv[1] == 'ninja': with open('compile_commands.json', 'r') as f: cc = json.load(f) output = set((x['output'] for x in cc)) for obj in sys.argv[2:]: if ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/22 object extraction/check-obj.py
#!/usr/bin/env python3 import sys import shutil shutil.copyfile(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/88 dep fallback/gensrc.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'w') as f: f.write('')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/88 dep fallback/subprojects/boblib/genbob.py
# Copyright © 2017 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/152 index customtarget/gen_sources.py
#!python3 import sys from pathlib import Path def main(): if len(sys.argv) != 2: print(sys.argv) return 1 if sys.argv[1] != 'gen.c': print(sys.argv) return 2 Path('foo').touch() return 0 if __name__ == '__main__': sys.exit(main())
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/152 index customtarget/check_args.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'w') as f: print('# this file does nothing', file=f)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/144 link depends custom target/make_file.py
#!/usr/bin/env python3 import sys, os dirname = sys.argv[1] fname = os.path.join(dirname, 'file.txt') os.makedirs(dirname, exist_ok=True) open(fname, 'w').close()
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/8 install/gendir.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'w') as f: f.write('Test')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/128 build by default targets in tests/write_file.py
#!/usr/bin/env python3 import sys, os assert(len(sys.argv) == 3) h_templ = '''#pragma once unsigned int %s(void); ''' c_templ = '''#include"%s.h" unsigned int %s(void) { return 0; } ''' ifile = sys.argv[1] outdir = sys.argv[2] base = os.path.splitext(os.path.split(ifile)[-1])[0] cfile = os.path.join(outdir, b...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/86 private include/stlib/compiler.py
#!/usr/bin/env python3 import shutil, sys, subprocess, argparse, pathlib parser = argparse.ArgumentParser() parser.add_argument('--private-dir', required=True) parser.add_argument('-o', nargs='+', required=True) parser.add_argument('cmparr', nargs='+') contents = ['''#include<stdio.h> void flob_1() { printf("N...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/210 link custom_i multiple from multiple/generate_stlibs.py
#!/usr/bin/env python3 import sys import shutil if '@INPUT1@' in sys.argv[1]: shutil.copyfile(sys.argv[2], sys.argv[3]) else: sys.exit('String @INPUT1@ not found in "{}"'.format(sys.argv[1]))
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/160 custom target template substitution/checkcopy.py
#!/usr/bin/env python3 """ generate sequence of filename that does not exceed MAX_LEN=260 for Python < 3.6 and Windows without modified registry """ import sys import string name_len = 260 - len(sys.argv[2]) - 4 - 39 - 4 - 2 if name_len < 1: raise ValueError('The meson build directory pathname is so long ' ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/227 very long commmand line/name_gen.py
#!/usr/bin/env python3 import sys from pathlib import Path Path(sys.argv[2]).write_text( 'int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1]))
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/227 very long commmand line/codegen.py
#!/usr/bin/env python3 import sys def main(): with open(sys.argv[1], 'w') as out: out.write(sys.argv[2]) out.write('\n') if __name__ == '__main__': main()
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/186 test depends/gen.py
#!/usr/bin/env python3 import os import os.path import sys def main(): print('Looking in:', os.getcwd()) not_found = list() for f in sys.argv[1:]: if not os.path.exists(f): not_found.append(f) if not_found: print('Not found:', ', '.join(not_found)) sys.exit(1) if...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/186 test depends/test.py
#!/usr/bin/env python3 import sys expected = { 'newline': '\n', 'dollar': '$', 'colon': ':', 'space': ' ', 'multi1': ' ::$$ ::$$', 'multi2': ' ::$$\n\n \n\n::$$', } output = None for arg in sys.argv[1:]: try: name, value = arg.split('=', 1) except ValueError: outp...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/141 special characters/check_quoting.py
#!/usr/bin/env python3 import sys ifile = sys.argv[1] ofile = sys.argv[2] with open(ifile) as f: resname = f.readline().strip() templ = 'const char %s[] = "%s";\n' with open(ofile, 'w') as f: f.write(templ % (resname, resname))
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/105 generatorcustom/gen.py
#!/usr/bin/env python3 import sys output = sys.argv[-1] inputs = sys.argv[1:-1] with open(output, 'w') as ofile: ofile.write('#pragma once\n') for i in inputs: with open(i) as ifile: content = ifile.read() ofile.write(content) ofile.write('\n')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/105 generatorcustom/catter.py
#!/usr/bin/env python3 import sys ofile = sys.argv[1] num = sys.argv[2] with open(ofile, 'w') as f: f.write(f'res{num}\n')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/105 generatorcustom/gen-resx.py
#!/usr/bin/env python3 # Mimic a binary that generates an object file (e.g. windres). import sys, subprocess if __name__ == '__main__': if len(sys.argv) != 4: print(sys.argv[0], 'compiler input_file output_file') sys.exit(1) compiler = sys.argv[1] ifile = sys.argv[2] ofile = sys.argv[...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/135 custom target object output/obj_generator.py
#!/usr/bin/env python3 import sys if __name__ == '__main__': if len(sys.argv) != 2: print(sys.argv[0], 'input_file') sys.exit(1) with open(sys.argv[1]) as f: ifile = f.read() if ifile != 'This is a text only input file.\n': print('Malformed input') sys.exit(1) p...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/common/109 custom target capture/my_compiler.py
#!/usr/bin/env python3 import sys import shutil shutil.copyfile(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/vala/8 generated sources/src/copy_file.py
#!/usr/bin/env python3 import sys contents = ''' void print_wrapper(string arg) { print (arg); } ''' with open(sys.argv[1], 'w') as f: f.write(contents)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/vala/8 generated sources/src/write_wrapper.py
#!/usr/bin/env python3 import sys c = '''int retval(void) { return 0; } ''' with open(sys.argv[1], 'w') as f: f.write(c)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/vala/10 mixed sources/c/writec.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'w') as f: print('EXPORTS', file=f) print(' somedllfunc', file=f)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/10 vs module defs generated custom target/subdir/make_def.py
#!/usr/bin/env python3 import sys with open(sys.argv[1], 'rb') as infile, open(sys.argv[2], 'wb') as outfile: outfile.write(infile.read())
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/14 resources with custom target depend_files/ico/gen-ico.py
#!/usr/bin/env python3 import sys import shutil shutil.copyfile(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/7 dll versioning/copyfile.py
#!/usr/bin/env python3 import os import sys try: import pefile except ImportError: if 'CI' in os.environ: raise # Skip the test if not on CI sys.exit(77) executable = sys.argv[1] expected = int(sys.argv[2]) actual = pefile.PE(executable).dump_dict()['OPTIONAL_HEADER']['Subsystem']['Value'] p...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/16 gui app/gui_app_tester.py
import subprocess import argparse import sys if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('prog') args = parser.parse_args() res = subprocess.run(args.prog) sys.exit(res.returncode - 42)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/13 test argument extra paths/test/test_run_exe.py
#!/usr/bin/env python3 print('ext/noext')
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/8 find program/test-script-ext.py
#!/usr/bin/env python3 import sys with open(sys.argv[1]) as infile, open(sys.argv[2], 'w') as outfile: outfile.write(infile.read().format(icon=sys.argv[3]))
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/windows/12 resources with custom targets/res/gen-res.py
#!/usr/bin/env python3 import sys import shutil shutil.copy(sys.argv[1], sys.argv[2])
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/7 gnome/resources/copyfile.py
#!/usr/bin/env python3 import os from gi.repository import Gio if __name__ == '__main__': res = Gio.resource_load(os.path.join('resources', 'simple-resources.gresource')) Gio.Resource._register(res) data = Gio.resources_lookup_data('/com/example/myprog/res1.txt', Gio.ResourceLookupFlags.NONE) assert(d...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/7 gnome/resources/resources.py
#!/usr/bin/env python3 from gi.repository import Meson, MesonDep1, MesonDep2 if __name__ == "__main__": s = Meson.Sample.new() dep1 = MesonDep1.Dep1.new() dep2 = MesonDep2.Dep2.new("Hello, meson/py!") s.print_message(dep1, dep2) s2 = Meson.Sample2.new() s2.print_message()
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/7 gnome/gir/prog.py
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # Copyright © 2021 Intel Corproation import argparse import shutil def main() -> None: parser = argparse.ArgumentParser() parser.add_argument('src') parser.add_argument('dest') args = parser.parse_args() shutil.copy(args.src, args.dest)...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/7 gnome/gir/copy.py
import sys sys.path.append(sys.argv[1]) # import compiled python module depending on version of python we are running with if sys.version_info[0] == 2: import python2_module if sys.version_info[0] == 3: import python3_module def run(): msg = 'howdy' if sys.version_info[0] == 2: w = python2_m...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/1 boost/test_python_module.py
#!/usr/bin/env python3 from gi.repository import MesonSub if __name__ == "__main__": s = MesonSub.Sample.new("Hello, sub/meson/py!") s.print_message()
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/11 gir subproject/gir/prog.py
#!/usr/bin/env python3 import os, sys, shutil ifile = sys.argv[1] ofile = sys.argv[2] try: os.unlink(ofile) except FileNotFoundError: pass shutil.copy(ifile, ofile)
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/6 gettext/generated/desktopgenerator.py
#!/usr/bin/env python3 import sys DOC_HEADER = '''<?xml version='1.0'?> <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> <refentry id=...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py
#!/usr/bin/env python3 import sys if len(sys.argv) > 1: with open(sys.argv[1], "w") as output: output.write("Hello World")
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/frameworks/4 qt/subfolder/generator.py
#!/usr/bin/env python3 import argparse import subprocess def main(): parser = argparse.ArgumentParser() parser.add_argument('ldd') parser.add_argument('bin') args = parser.parse_args() p, o, _ = subprocess.run([args.ldd, args.bin], stdout=subprocess.PIPE) assert p == 0 o = o.decode() ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/test cases/d/3 shared library/lld-test.py
# Copyright 2021 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/ci/usercustomize.py
#!/usr/bin/env python3 import json import argparse import stat import textwrap import shutil import subprocess from tempfile import TemporaryDirectory from pathlib import Path import typing as T image_namespace = 'mesonbuild' image_def_file = 'image.json' install_script = 'install.sh' class ImageDef: def __init...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/ci/ciimage/build.py
#!/usr/bin/env python3 # Copyright 2019 The Meson development team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/meson/docs/genrelnotes.py
#!/usr/bin/env python from __future__ import print_function import sys import bitstring from capstone import * from capstone.m68k import * # # Objdump with the same output as his binary cousin # TODO = """ TODO : o need more testing on M68K_AM_*_DISP o cleanup, etc ... """ objdump_cmd_example = 'm68k-atari-mi...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/contrib/objdump/objdump-m68k.py
#!/usr/bin/python # Simple benchmark for Capstone by disassembling random code. By Nguyen Anh Quynh, 2014 # Syntax: # ./suite/benchmark.py --> Benchmark all archs # ./suite/benchmark.py x86 --> Benchmark all X86 (all 16bit, 32bit, 64bit) # ./suite/benchmark.py x86-32 --> Benchmark X86-32 arch only # ./...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/benchmark.py
#!/usr/bin/python # Test tool to disassemble MC files. By Nguyen Anh Quynh, 2017 import array, os.path, sys from capstone import * # convert all hex numbers to decimal numbers in a text def normalize_hex(a): while(True): i = a.find('0x') if i == -1: # no more hex number break h...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/disasm_mc.py
#!/usr/bin/env python # Capstone by Nguyen Anh Quynnh <[email protected]> # PPC Branch testing suite by kratolp from __future__ import print_function import sys from capstone import * CODE32 = b"\x48\x01\x05\x15" # bl .+0x10514 CODE32 += b"\x4B\xff\xff\xfd" # bl .-0x4 CODE32 += b"\x48\x00\x00\x0c" # b .+0xc CODE32 +=...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/ppcbranch.py
#!/usr/bin/python from capstone import * from capstone.arm import * from capstone.arm64 import * from capstone.mips import * from capstone.ppc import * from capstone.sparc import * from capstone.systemz import * from capstone.x86 import * from capstone.xcore import * from capstone.riscv import * import sys class Grou...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/test_group_name.py
#!/usr/bin/python # By Nguyen Anh Quynh, 2015 # This tool extract sizes of immediadte operands from X86 instruction names. # Syntax: ./autogen_x86imm.py # Gather immediate sizes to put into X86ImmSize.inc OUTPUT = "../arch/X86/X86ImmSize.inc" f = open("../arch/X86/X86GenInstrInfo.inc") f2 = open(OUTPUT, "w") for line...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/autogen_x86imm.py
#!/usr/bin/python # Test tool to compare Capstone output with llvm-mc. By Nguyen Anh Quynh, 2014 import sys import os from capstone import * def test_file(fname): print("Test %s" %fname); f = open(fname) lines = f.readlines() f.close() if not lines[0].startswith('# '): print("ERROR: decodi...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/test_corpus.py
#!/usr/bin/env python # Capstone Python bindings, by Nguyen Anh Quynnh <[email protected]> from __future__ import print_function import sys from capstone import * CODE32 = b"\xc0\xe0\x02" CODE32 += b"\xc0\xf6\x02" # sal dh, 0 CODE32 += b"\xc1\xf6\x00" # sal esi, 0 CODE32 += b"\x82\xc0\x00" C...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/x86odd.py
#!/bin/sh # this prints out Capstone setup & core+Python-binding versions python -c "import capstone; print capstone.debug()"
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/python_capstone_setup.py
#!/usr/bin/env python # By Daniel Pistelli & Nguyen Tan Cong # This script is to patch DLL/EXE MajorVersion to 5, # so they can be loaded by Windows XP. # This is the problem introduced by compiling on Windows 7, using VS2013. import sys, struct if len(sys.argv) < 2: print("Usage: %s <pe_file_path>" % sys.argv[0...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/patch_major_os_version.py
#!/usr/bin/python # Test tool to compare Capstone output with llvm-mc. By Nguyen Anh Quynh, 2014 import array, os.path, sys from subprocess import Popen, PIPE, STDOUT from capstone import * # convert all hex numbers to decimal numbers in a text def normalize_hex(a): while(True): i = a.find('0x') i...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/test_mc.py
#!/usr/bin/env python # Capstone Python bindings, by Nguyen Anh Quynnh <[email protected]> from __future__ import print_function import sys from capstone import * all_tests = ( # arch, mode, syntax, address, hexcode, expected output # issue 456 https://github.com/aquynh/capstone/issues/456 (CS...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/regress.py
#!/usr/bin/python # Simple fuzzing tool by disassembling random code. By Nguyen Anh Quynh, 2014 # Syntax: # ./suite/fuzz.py --> Fuzz all archs # ./suite/fuzz.py x86 --> Fuzz all X86 (all 16bit, 32bit, 64bit) # ./suite/fuzz.py x86-16 --> Fuzz X86-32 arch only # ./suite/fuzz.py x86-32 --> Fuzz X86-32 a...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/fuzz.py
#!/usr/bin/python import unittest from os.path import dirname, basename, isfile import glob # Find all unittest type in this directory and run it. class RegressTest(unittest.TestCase): pass def main(): unittest.main() if __name__ == '__main__': directory = dirname(__file__) if directory == '': ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/regress/regress.py
#!/usr/bin/python # print MappingInsn.inc file from LLVM GenAsmMatcher.inc, for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenAsmMatcher.inc> <GenInstrInfo.inc> <MappingInsnOp.inc>" %sys.argv[0]) sys.exit(1) f = open(sys.argv[3]) mapping = f.readli...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/mapping_insn_op.py
#!/usr/bin/python # convert LLVM GenSystemRegister.inc for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenSystemRegister.inc>" %sys.argv[0]) sys.exit(1) f = open(sys.argv[1]) lines = f.readlines() f.close() #arch = sys.argv[2].upper() print(""" /*...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/systemregister.py
#!/usr/bin/python # convert LLVM GenRegisterInfo.inc for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenRegisterInfo.inc> <architecture>" %sys.argv[0]) sys.exit(1) f = open(sys.argv[1]) lines = f.readlines() f.close() arch = sys.argv[2] print(""" ...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/registerinfo.py
#!/usr/bin/python # convert LLVM GenSystemOperands.inc of AArch64 for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenSystemOperands.inc> <GenSystemOperands.inc> <GenSystemOperands_enum.inc>" %sys.argv[0]) sys.exit(1) f = open(sys.argv[1]) lines = f....
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/systemoperand.py
#!/usr/bin/python # print out all registers from LLVM GenRegisterInfo.inc for Capstone disassembler. # NOTE: the list then must be filtered, manually. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenRegisterInfo.inc> <architecture>" %sys.argv[0]) sys.exit(1) f = open(sys.a...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/mapping_reg.py
#!/usr/bin/python # print out all registers from LLVM GenRegisterInfo.inc for Capstone disassembler. # NOTE: the list then must be filtered, manually. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenRegisterInfo.inc> <architecture>" %sys.argv[0]) sys.exit(1) f = open(sys.a...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/register.py
#!/usr/bin/python # print list of instructions LLVM inc files, for Capstone disassembler. # this will be put into capstone/<arch>.h # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenAsmMatcher.inc>" %sys.argv[0]) sys.exit(1) print("""/* Capstone Disassembly Engine, http://ww...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/insn3.py
#!/usr/bin/python # compare instructions in 2 files of MappingInsn.inc # find instructions in MappingInsn1, that does not exist in MappingInsn2 # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <MappingInsn1.inc> <MappingInsn2.inc>" %sys.argv[0]) sys.exit(1) f = open(sys.argv[1]...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/compare_mapping_insn.py
#!/usr/bin/python # check MappingInsn.inc to find potential incorrect mapping - for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <MappingInsn.inc>" %sys.argv[0]) sys.exit(1) # ARM_CMPri, ARM_INS_CMN, f = open(sys.argv[1]) lines = f.readlines() f.cl...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/insn_check.py
#!/usr/bin/python # print list of instructions LLVM inc files, for Capstone disassembler. # this will be put into capstone/<arch>.h # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenAsmMatcher.inc>" %sys.argv[0]) sys.exit(1) print("""/* Capstone Disassembly Engine, http://ww...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/mapping_insn_name-arch.py
#!/usr/bin/python # print MappingInsn.inc file from LLVM GenAsmMatcher.inc, for Capstone disassembler. # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenAsmMatcher.inc> <GenInstrInfo.inc> MappingInsn.inc" %sys.argv[0]) sys.exit(1) f = open(sys.argv[3]) mapping = f.readlines(...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/mapping_insn-arch.py
#!/usr/bin/python # convert LLVM GenDisassemblerTables.inc for Capstone disassembler. # for X86, this separate ContextDecision tables into another file # by Nguyen Anh Quynh, 2019 import sys if len(sys.argv) == 1: print("Syntax: %s <GenDisassemblerTables.inc> <X86GenDisassemblerTables.inc> <X86GenDisassemblerTabl...
nvtrust-main
infrastructure/kvm/qemu/qemu_source/capstone/suite/synctools/disassemblertables.py