Beispiel #1
0
        sys.exit("Error, non-print statement of unknown kind '%s'." % kind)


for filename in sorted(os.listdir('.')):
    if not filename.endswith(".py") or filename.startswith("run_"):
        continue

    active = search_mode.consider(dirname=None, filename=filename)

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        if python_version.startswith('3'):
            filename, changed = convertUsing2to3(filename)
        else:
            changed = False

        my_print("Consider", filename, end=' ')

        command = [
            os.environ["PYTHON"],
            os.path.abspath(os.path.join("..", "..", "bin", "nuitka")),
            "--dump-xml", "--module", filename
        ]

        if search_mode.isCoverage():
            # To avoid re-execution, which is not acceptable to coverage.
            if "PYTHONHASHSEED" not in os.environ:
                os.environ["PYTHONHASHSEED"] = '0'
Beispiel #2
0
    # Skip tests that require Python 2.7 at least.
    if filename.endswith("27.py") and python_version.startswith("2.6"):
        continue

    path = filename

    if not active and start_at in (filename, path):
        active = True


    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        if python_version.startswith("3"):
            path, changed = convertUsing2to3(path)
        else:
            changed = True

        my_print("Consider", path, end = " ")

        command = [
            os.environ["PYTHON"],
            os.path.join("..", "..", "bin", "nuitka"),
            "--dump-xml",
            "--module",
            path
        ]

        result = check_output(
            command
Beispiel #3
0
print("PYTHON='%s'" % python_version)
print("TEST_CASE_HASH='%s'" % md5.md5(open(test_case).read()).hexdigest())


needs_2to3 = python_version.startswith("3") and \
             not test_case.endswith("32.py") and \
             not test_case.endswith("33.py")

if options.target_dir:
    shutil.copy(
        test_case,
        os.path.join(options.target_dir, os.path.basename(test_case))
    )

if needs_2to3:
    test_case = convertUsing2to3(test_case)

def runValgrind( descr, test_case, args ):
    print(descr, file=sys.stderr, end="... ")

    log_base = test_case[:-3] if test_case.endswith( ".py" ) else test_case
    log_file = log_base + ".log"

    valgrind_options = "-q --tool=callgrind --callgrind-out-file=%s" % log_file

    command = ["valgrind"] + valgrind_options.split() + list(args)

    process = subprocess.Popen(
        args   = command,
        stdout = subprocess.PIPE,
        stderr = subprocess.PIPE
Beispiel #4
0
my_print("PYTHON_BINARY='%s'" % os.environ["PYTHON"])
my_print("TEST_CASE_HASH='%s'" % hashlib.md5(open(test_case, "rb").read()).hexdigest())


needs_2to3 = python_version.startswith('3') and \
             not test_case.endswith("32.py") and \
             not test_case.endswith("33.py")

if options.target_dir:
    shutil.copy(
        test_case,
        os.path.join(options.target_dir, os.path.basename(test_case))
    )

if needs_2to3:
    test_case, needs_delete = convertUsing2to3(test_case)

def runValgrind(descr, test_case, args):
    my_print(descr, file = sys.stderr, end = "... ")

    log_base = test_case[:-3] if test_case.endswith(".py") else test_case
    log_file = log_base + ".log"

    valgrind_options = "-q --tool=callgrind --callgrind-out-file=%s" % log_file

    command = ["valgrind"] + valgrind_options.split() + list(args)

    process = subprocess.Popen(
        args   = command,
        stdout = subprocess.PIPE,
        stderr = subprocess.PIPE
Beispiel #5
0
my_print("PYTHON='%s'" % python_version)
my_print("PYTHON_BINARY='%s'" % os.environ["PYTHON"])
my_print("TEST_CASE_HASH='%s'" %
         hashlib.md5(open(test_case, "rb").read()).hexdigest())


needs_2to3 = python_version.startswith('3') and \
             not test_case.endswith("32.py") and \
             not test_case.endswith("33.py")

if options.target_dir:
    shutil.copy(test_case,
                os.path.join(options.target_dir, os.path.basename(test_case)))

if needs_2to3:
    test_case, needs_delete = convertUsing2to3(test_case)


def runValgrind(descr, test_case, args):
    my_print(descr, file=sys.stderr, end="... ")

    log_base = test_case[:-3] if test_case.endswith(".py") else test_case
    log_file = log_base + ".log"

    valgrind_options = "-q --tool=callgrind --callgrind-out-file=%s" % log_file

    command = ["valgrind"] + valgrind_options.split() + list(args)

    process = subprocess.Popen(args=command,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
Beispiel #6
0
assert os.path.exists(test_case), (test_case, os.getcwd())

print("PYTHON='%s'" % python_version)
print("TEST_CASE_HASH='%s'" % md5.md5(open(test_case).read()).hexdigest())


needs_2to3 = python_version.startswith("3") and \
             not test_case.endswith("32.py") and \
             not test_case.endswith("33.py")

if options.target_dir:
    shutil.copy(test_case,
                os.path.join(options.target_dir, os.path.basename(test_case)))

if needs_2to3:
    test_case = convertUsing2to3(test_case)


def runValgrind(descr, test_case, args):
    print(descr, file=sys.stderr, end="... ")

    log_base = test_case[:-3] if test_case.endswith(".py") else test_case
    log_file = log_base + ".log"

    valgrind_options = "-q --tool=callgrind --callgrind-out-file=%s" % log_file

    command = ["valgrind"] + valgrind_options.split() + list(args)

    process = subprocess.Popen(args=command,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
Beispiel #7
0
    if filename.endswith("27.py") and python_version.startswith(b"2.6"):
        continue

    path = filename

    if not active and start_at in (filename, path):
        active = True

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        assert type(python_version) is bytes

        if python_version.startswith(b"3"):
            path = convertUsing2to3(path)

        my_print("Consider", path, end=" ")

        command = [os.environ["PYTHON"], os.path.join("..", "..", "bin", "nuitka"), "--dump-xml", "--module", path]

        result = check_output(command)

        # Parse the result into XML and check it.
        root = lxml.etree.fromstring(result)
        module_body = root[0]
        module_statements_sequence = module_body[0]

        assert len(module_statements_sequence) == 1
        module_statements = iter(module_statements_sequence).next()
Beispiel #8
0
for filename in sorted(os.listdir('.')):
    if not filename.endswith(".py") or filename.startswith("run_"):
        continue

    active = search_mode.consider(
        dirname  = None,
        filename = filename
    )

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        if python_version.startswith('3'):
            filename, changed = convertUsing2to3(filename)
        else:
            changed = False

        my_print("Consider", filename, end = ' ')

        command = [
            os.environ["PYTHON"],
            os.path.abspath(os.path.join("..", "..", "bin", "nuitka")),
            "--dump-xml",
            "--module",
            filename
        ]


        if search_mode.isCoverage():
Beispiel #9
0
    if filename.endswith("27.py") and python_version.startswith(b"2.6"):
        continue

    path = filename

    if not active and start_at in (filename, path):
        active = True

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        assert type(python_version) is bytes

        if python_version.startswith(b"3"):
            path = convertUsing2to3(path)

        my_print("Consider", path, end=" ")

        command = [
            os.environ["PYTHON"],
            os.path.join("..", "..", "bin", "nuitka"), "--dump-xml",
            "--module", path
        ]

        result = check_output(command)

        # Parse the result into XML and check it.
        root = lxml.etree.fromstring(result)
        module_body = root[0]
        module_statements_sequence = module_body[0]
Beispiel #10
0
        case = 2

    if not inside or case == 2:
        case_2_file.write(line)
    else:
        case_2_file.write('\n')

    if "# construct_begin" in line:
        inside = True
        case = 1

case_1_file.close()
case_2_file.close()

if needs_2to3:
    test_case_1, needs_delete = convertUsing2to3(test_case_1)
    test_case_2, needs_delete = convertUsing2to3(test_case_2)

os.environ["PYTHONHASHSEED"] = '0'

if nuitka:
    nuitka_id = subprocess.check_output("cd %s; git rev-parse HEAD" %
                                        os.path.dirname(nuitka),
                                        shell=True)
    nuitka_id = nuitka_id.strip()

    if sys.version_info > (3, ):
        nuitka_id = nuitka_id.decode()

    my_print("NUITKA_COMMIT='%s'" % nuitka_id)
Beispiel #11
0
    # Skip tests that require Python 2.7 at least.
    if filename.endswith("27.py") and python_version.startswith("2.6"):
        continue

    path = filename

    if not active and start_at in (filename, path):
        active = True

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        if python_version.startswith("3"):
            path, changed = convertUsing2to3(path)
        else:
            changed = True

        my_print("Consider", path, end=" ")

        command = [
            os.environ["PYTHON"],
            os.path.join("..", "..", "bin", "nuitka"), "--dump-xml",
            "--module", path
        ]

        result = check_output(command)

        # Parse the result into XML and check it.
        root = lxml.etree.fromstring(result)