Пример #1
0
def test_cpuinfo_linux():
    if not sys.platform.startswith('linux'):
        py.test.skip("linux only")
    saved = os.environ
    try:
        os.environ = FakeEnviron(None)
        assert support.detect_number_of_processors(StringIO(cpuinfo)) == 3
        assert support.detect_number_of_processors('random crap that does not exist') == 1
        os.environ = FakeEnviron('-j2')
        assert support.detect_number_of_processors(StringIO(cpuinfo)) == 1
    finally:
        os.environ = saved
Пример #2
0
def test_cpuinfo_linux():
    if not sys.platform.startswith('linux'):
        py.test.skip("linux only")
    saved = os.environ
    try:
        os.environ = FakeEnviron(None)
        assert support.detect_number_of_processors(StringIO(cpuinfo)) == 3
        assert support.detect_number_of_processors(
            'random crap that does not exist') == 1
        os.environ = FakeEnviron('-j2')
        assert support.detect_number_of_processors(StringIO(cpuinfo)) == 1
    finally:
        os.environ = saved
Пример #3
0
def test_cpuinfo_darwin():
    if sys.platform != 'darwin':
        py.test.skip('mac only')
    saved_func = support.darwin_get_cpu_count
    saved = os.environ
    def count():
        return 42
    try:
        support.darwin_get_cpu_count = count
        os.environ = FakeEnviron(None)
        assert support.detect_number_of_processors() == 42
        os.environ = FakeEnviron('-j2')
        assert support.detect_number_of_processors() == 1
    finally:
        os.environ = saved
        support.darwin_get_cpu_count = saved_func
Пример #4
0
def test_cpuinfo_darwin():
    if sys.platform != 'darwin':
        py.test.skip('mac only')
    saved_func = support.darwin_get_cpu_count
    saved = os.environ

    def count():
        return 42

    try:
        support.darwin_get_cpu_count = count
        os.environ = FakeEnviron(None)
        assert support.detect_number_of_processors() == 42
        os.environ = FakeEnviron('-j2')
        assert support.detect_number_of_processors() == 1
    finally:
        os.environ = saved
        support.darwin_get_cpu_count = saved_func
Пример #5
0
                   requires=[("translation.no__thread", True)]),
        BoolOption("no__thread",
                   "don't use __thread for implementing TLS",
                   default=False,
                   cmdline="--no__thread",
                   negation=False),
        StrOption("compilerflags",
                  "Specify flags for the C compiler",
                  cmdline="--cflags"),
        StrOption("linkerflags",
                  "Specify flags for the linker (C backend only)",
                  cmdline="--ldflags"),
        IntOption("make_jobs", "Specify -j argument to make for compilation"
                  " (C backend only)",
                  cmdline="--make-jobs",
                  default=detect_number_of_processors()),

        # Flags of the TranslationContext:
        BoolOption("simplifying", "Simplify flow graphs", default=True),
        BoolOption("builtins_can_raise_exceptions",
                   "When true, assume any call to a 'simple' builtin such as "
                   "'hex' can raise an arbitrary exception",
                   default=False,
                   cmdline=None),
        BoolOption("list_comprehension_operations",
                   "When true, look for and special-case the sequence of "
                   "operations that results from a list comprehension and "
                   "attempt to pre-allocate the list",
                   default=False,
                   cmdline='--listcompr'),
        IntOption(
Пример #6
0
     requires=[("translation.no__thread", True)],
 ),
 BoolOption(
     "no__thread",
     "don't use __thread for implementing TLS",
     default=False,
     cmdline="--no__thread",
     negation=False,
 ),
 StrOption("compilerflags", "Specify flags for the C compiler", cmdline="--cflags"),
 StrOption("linkerflags", "Specify flags for the linker (C backend only)", cmdline="--ldflags"),
 IntOption(
     "make_jobs",
     "Specify -j argument to make for compilation" " (C backend only)",
     cmdline="--make-jobs",
     default=detect_number_of_processors(),
 ),
 # Flags of the TranslationContext:
 BoolOption("simplifying", "Simplify flow graphs", default=True),
 BoolOption(
     "builtins_can_raise_exceptions",
     "When true, assume any call to a 'simple' builtin such as " "'hex' can raise an arbitrary exception",
     default=False,
     cmdline=None,
 ),
 BoolOption(
     "list_comprehension_operations",
     "When true, look for and special-case the sequence of "
     "operations that results from a list comprehension and "
     "attempt to pre-allocate the list",
     default=False,
Пример #7
0
    # portability options
    BoolOption("vanilla",
               "Try to be as portable as possible, which is not much",
               default=False,
               cmdline="--vanilla",
               requires=[("translation.no__thread", True)]),
    BoolOption("no__thread",
               "don't use __thread for implementing TLS",
               default=False, cmdline="--no__thread", negation=False),
    StrOption("compilerflags", "Specify flags for the C compiler",
               cmdline="--cflags"),
    StrOption("linkerflags", "Specify flags for the linker (C backend only)",
               cmdline="--ldflags"),
    IntOption("make_jobs", "Specify -j argument to make for compilation"
              " (C backend only)",
              cmdline="--make-jobs", default=detect_number_of_processors()),

    # Flags of the TranslationContext:
    BoolOption("simplifying", "Simplify flow graphs", default=True),
    BoolOption("builtins_can_raise_exceptions",
               "When true, assume any call to a 'simple' builtin such as "
               "'hex' can raise an arbitrary exception",
               default=False,
               cmdline=None),
    BoolOption("list_comprehension_operations",
               "When true, look for and special-case the sequence of "
               "operations that results from a list comprehension and "
               "attempt to pre-allocate the list",
               default=False,
               cmdline='--listcompr'),
    IntOption("withsmallfuncsets",