示例#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
def test_cpuinfo_sysctl():
    if sys.platform != 'darwin' and not sys.platform.startswith('freebsd'):
        py.test.skip('mac and bsd only')
    saved_func = support.sysctl_get_cpu_count
    saved = os.environ
    def count(cmd):
        if sys.platform == 'darwin':
            assert cmd == '/usr/sbin/sysctl'
        else:
            assert cmd == '/sbin/sysctl'
        return 42
    try:
        support.sysctl_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.sysctl_get_cpu_count = saved_func
示例#6
0
        BoolOption("dump_static_data_info",
                   "Dump static data info",
                   cmdline="--dump_static_data_info",
                   default=False,
                   requires=[("translation.backend", "c")]),

        # portability options
        BoolOption("no__thread",
                   "don't use __thread for implementing TLS",
                   default=not SUPPORT__THREAD,
                   cmdline="--no__thread",
                   negation=False),
        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("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",
            "Represent groups of less funtions than this as indices into an array",
            default=0),
        BoolOption("taggedpointers",
                   "When true, enable the use of tagged pointers. "
                   "If false, use normal boxing",
示例#7
0
    StrOption("output", "Output file name", cmdline="--output"),
    StrOption("secondaryentrypoints",
            "Comma separated list of keys choosing secondary entrypoints",
            cmdline="--entrypoints", default="main"),

    BoolOption("dump_static_data_info", "Dump static data info",
               cmdline="--dump_static_data_info",
               default=False, requires=[("translation.backend", "c")]),

    # portability options
    BoolOption("no__thread",
               "don't use __thread for implementing TLS",
               default=False, cmdline="--no__thread", negation=False),
    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("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",
              "Represent groups of less funtions than this as indices into an array",
               default=0),
    BoolOption("taggedpointers",
               "When true, enable the use of tagged pointers. "
               "If false, use normal boxing",
               default=False),
示例#8
0
    StrOption("secondaryentrypoints",
            "Comma separated list of keys choosing secondary entrypoints",
            cmdline="--entrypoints", default="main"),

    BoolOption("dump_static_data_info", "Dump static data info",
               cmdline="--dump_static_data_info",
               default=False, requires=[("translation.backend", "c")]),

    # portability options
    BoolOption("no__thread",
               "don't use __thread for implementing TLS",
               default=not SUPPORT__THREAD, cmdline="--no__thread",
               negation=False),
    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("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",
              "Represent groups of less funtions than this as indices into an array",
               default=0),
    BoolOption("taggedpointers",
               "When true, enable the use of tagged pointers. "
               "If false, use normal boxing",
               default=False),
     default=False,
     requires=[("translation.backend", "c")],
 ),
 # portability options
 BoolOption(
     "no__thread",
     "don't use __thread for implementing TLS",
     default=not SUPPORT__THREAD,
     cmdline="--no__thread",
     negation=False,
 ),
 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(
     "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", "Represent groups of less funtions than this as indices into an array", default=0
 ),
 BoolOption(
     "taggedpointers",