Пример #1
0
sys.path.insert(
    0,
    os.path.normpath(
        os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from test_common import (my_print, setup, getTempDir)

python_version = setup()

# TODO: This ought to no longer be necessary, removing it could highlight bugs.
# No random hashing, it makes comparing outputs futile.
if "PYTHONHASHSEED" not in os.environ:
    os.environ["PYTHONHASHSEED"] = '0'

nuitka_main_path = os.path.join("..", "..", "bin", "nuitka")

tmp_dir = getTempDir()

# TODO: Could detect this more automatic.
PACKAGE_LIST = (
    "nuitka",
    "nuitka/nodes",
    "nuitka/tree",
    "nuitka/importing",
    "nuitka/build",
    "nuitka/freezer",
    "nuitka/gui",
    "nuitka/codegen",
    "nuitka/codegen/templates",
    "nuitka/optimizations",
    "nuitka/finalizations",
    "nuitka/plugins",
Пример #2
0
    assert exit_valgrind == 0, stderr_valgrind
    my_print("OK", file = sys.stderr)
    try:
        for line in open(log_file):
            if line.startswith("summary:"):
                return int(line.split()[1])

        else:
            assert False
    finally:
        os.unlink(log_file)



# First produce two variants.
temp_dir = getTempDir()

test_case_1 = os.path.join(
    temp_dir,
    "Variant1_" + os.path.basename(test_case)
)
test_case_2 = os.path.join(
    temp_dir,
    "Variant2_" + os.path.basename(test_case)
)

case_1_file = open(test_case_1, 'w')
case_2_file = open(test_case_2, 'w')

inside = False
case = 0
Пример #3
0
    # The use of "__main__" in the test package gives a warning.
    if filename == "sub_package":
        extra_flags.append("ignore_warnings")

    if active:
        my_print("Consider output of recursively compiled program:", path)

        for filename_main in os.listdir(filename):
            if not os.path.isdir(os.path.join(filename, filename_main)):
                continue

            if filename_main not in ("..", "."):
                break
        else:
            sys.exit("""\
Error, no package in dir '%s' found, incomplete test case.""" % filename)

        os.environ[ "NUITKA_EXTRA_OPTIONS" ] = \
          "--recurse-to=%s" % os.path.basename(filename_main)

        os.environ[ "NUITKA_EXTRA_OPTIONS" ] += \
          " --output-dir=%s" % getTempDir()

        compareWithCPython(path=os.path.join(filename, filename_main),
                           extra_flags=extra_flags,
                           search_mode=search_mode,
                           needs_2to3=False)
    else:
        my_print("Skipping", filename)
Пример #4
0
    assert exit_valgrind == 0, stderr_valgrind
    print("OK", file=sys.stderr)
    try:
        for line in open(log_file):
            if line.startswith("summary:"):
                return int(line.split()[1])

        else:
            assert False
    finally:
        os.unlink(log_file)


# First produce two variants.
temp_dir = getTempDir()

test_case_1 = os.path.join(temp_dir, "Variant1_" + os.path.basename(test_case))
test_case_2 = os.path.join(temp_dir, "Variant2_" + os.path.basename(test_case))

case_1_file = open(test_case_1, "w")
case_2_file = open(test_case_2, "w")

inside = False
case = 0

for line in open(test_case):
    if not inside or case == 1:
        case_1_file.write(line)
    else:
        case_1_file.write("\n")
Пример #5
0
from test_common import (
    my_print,
    setup,
    getTempDir
)

python_version = setup()

# TODO: This ought to no longer be necessary, removing it could highlight bugs.
# No random hashing, it makes comparing outputs futile.
if "PYTHONHASHSEED" not in os.environ:
    os.environ["PYTHONHASHSEED"] = '0'

nuitka_main_path = os.path.join("..", "..", "bin", "nuitka")

tmp_dir = getTempDir()

# TODO: Could detect this more automatic.
PACKAGE_LIST = (
    "nuitka",
    "nuitka/nodes",
    "nuitka/tree",
    "nuitka/importing",
    "nuitka/build",
    "nuitka/freezer",
    "nuitka/gui",
    "nuitka/codegen",
    "nuitka/codegen/templates",
    "nuitka/optimizations",
    "nuitka/finalizations",
    "nuitka/plugins",
Пример #6
0
    if active:
        my_print( "Consider output of recursively compiled program:", path )

        for filename_main in os.listdir( filename ):
            if not os.path.isdir(os.path.join(filename,filename_main)):
                continue

            if filename_main not in ( "..", "." ):
                break
        else:
            sys.exit(
                """\
Error, no package in dir '%s' found, incomplete test case.""" % filename
            )

        os.environ[ "NUITKA_EXTRA_OPTIONS" ] = \
          "--recurse-to=%s" % os.path.basename(filename_main)

        os.environ[ "NUITKA_EXTRA_OPTIONS" ] += \
          " --output-dir=%s" % getTempDir()


        compareWithCPython(
            path        = os.path.join( filename, filename_main ),
            extra_flags = extra_flags,
            search_mode = search_mode,
            needs_2to3  = False
        )
    else:
        my_print( "Skipping", filename )
Пример #7
0
            if not os.path.isdir(os.path.join(filename,filename_main)):
                continue

            if filename_main not in ("..", '.'):
                break
        else:
            sys.exit(
                """\
Error, no package in dir '%s' found, incomplete test case.""" % filename
            )

        extensions = [
            "--recurse-to=%s" % os.path.basename(filename_main)
        ]

        if not "--output-dir" in os.environ.get("NUITKA_EXTRA_OPTIONS", ""):
            extensions.append("--output-dir=%s" % getTempDir())

        with withExtendedExtraOptions(*extensions):
            compareWithCPython(
                dirname     = filename,
                filename    = filename_main,
                extra_flags = extra_flags,
                search_mode = search_mode,
                needs_2to3  = False
            )
    else:
        my_print("Skipping", filename)

search_mode.finish()
Пример #8
0
    active = search_mode.consider(dirname=None, filename=filename)

    if active:
        my_print("Consider output of recursively compiled program:", filename)

        for filename_main in os.listdir(filename):
            if not os.path.isdir(os.path.join(filename, filename_main)):
                continue

            if filename_main not in ("..", '.'):
                break
        else:
            sys.exit("""\
Error, no package in dir '%s' found, incomplete test case.""" % filename)

        extensions = ["--recurse-to=%s" % os.path.basename(filename_main)]

        if not "--output-dir" in os.environ.get("NUITKA_EXTRA_OPTIONS", ""):
            extensions.append("--output-dir=%s" % getTempDir())

        with withExtendedExtraOptions(*extensions):
            compareWithCPython(dirname=filename,
                               filename=filename_main,
                               extra_flags=extra_flags,
                               search_mode=search_mode,
                               needs_2to3=False)
    else:
        my_print("Skipping", filename)

search_mode.finish()
Пример #9
0
    active = search_mode.consider(dirname=None, filename=filename)

    if active:
        my_print("Consider output of recursively compiled program:", filename)

        for filename_main in os.listdir(filename):
            if not os.path.isdir(os.path.join(filename, filename_main)):
                continue

            if filename_main not in ("..", "."):
                break
        else:
            sys.exit(
                """\
Error, no package in dir '%s' found, incomplete test case."""
                % filename
            )

        os.environ["NUITKA_EXTRA_OPTIONS"] = "--recurse-to=%s" % os.path.basename(filename_main)

        os.environ["NUITKA_EXTRA_OPTIONS"] += " --output-dir=%s" % getTempDir()

        compareWithCPython(
            dirname=filename, filename=filename_main, extra_flags=extra_flags, search_mode=search_mode, needs_2to3=False
        )
    else:
        my_print("Skipping", filename)

search_mode.finish()