def test_cpu_model_linux(self):
        """Test getting CPU model (mocked for Linux)."""
        st.get_os_type = lambda: st.LINUX
        st.read_file = mocked_read_file
        st.is_readable = lambda fp: mocked_is_readable(PROC_CPUINFO_FP, fp)
        st.platform.uname = mocked_uname
        global MACHINE_NAME
        global PROC_CPUINFO_TXT

        MACHINE_NAME = 'x86_64'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_INTEL
        self.assertEqual(get_cpu_model(), "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_AMD
        self.assertEqual(get_cpu_model(), "Six-Core AMD Opteron(tm) Processor 2427")

        MACHINE_NAME = 'ppc64'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_POWER
        self.assertEqual(get_cpu_model(), "IBM,8205-E6C")

        MACHINE_NAME = 'armv7l'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_RASPI2
        self.assertEqual(get_cpu_model(), "ARM Cortex-A7")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_ODROID_XU3
        self.assertEqual(get_cpu_model(), "ARM Cortex-A7 + Cortex-A15")
Exemple #2
0
    def test_cpu_model_linux(self):
        """Test getting CPU model (mocked for Linux)."""
        st.get_os_type = lambda: st.LINUX
        st.read_file = mocked_read_file
        st.is_readable = lambda fp: mocked_is_readable(PROC_CPUINFO_FP, fp)
        st.platform.uname = mocked_uname
        global MACHINE_NAME
        global PROC_CPUINFO_TXT

        MACHINE_NAME = 'x86_64'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_INTEL
        self.assertEqual(get_cpu_model(),
                         "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_AMD
        self.assertEqual(get_cpu_model(),
                         "Six-Core AMD Opteron(tm) Processor 2427")

        MACHINE_NAME = 'ppc64'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_POWER
        self.assertEqual(get_cpu_model(), "IBM,8205-E6C")

        MACHINE_NAME = 'armv7l'
        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_RASPI2
        self.assertEqual(get_cpu_model(), "ARM Cortex-A7")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_ODROID_XU3
        self.assertEqual(get_cpu_model(), "ARM Cortex-A7 + Cortex-A15")
    def test_cpu_model_linux(self):
        """Test getting CPU model (mocked for Linux)."""
        st.get_os_type = lambda: st.LINUX
        st.read_file = mocked_read_file
        st.os.path.exists = lambda fp: mocked_os_path_exists(PROC_CPUINFO_FP, fp)
        global PROC_CPUINFO_TXT

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_X86
        self.assertEqual(get_cpu_model(), "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_POWER
        self.assertEqual(get_cpu_model(), "IBM,8205-E6C")

        PROC_CPUINFO_TXT = PROC_CPUINFO_TXT_ARM
        self.assertEqual(get_cpu_model(), "ARMv7 Processor rev 5 (v7l)")
Exemple #4
0
    def _guess_aarch64_default_optarch(self):
        """
        Guess default optarch for AARCH64 (vanilla ARM cores only)
        This heuristic may fail if the CPU module is not supported by the GCC version being used.
        """
        default_optarch = None
        cpu_vendor = systemtools.get_cpu_vendor()
        cpu_model = systemtools.get_cpu_model()

        if cpu_vendor == systemtools.ARM and cpu_model.startswith('ARM '):
            self.log.debug("Determining architecture-specific optimization flag for ARM (model: %s)", cpu_model)
            core_types = []
            for core_type in [ct.strip().lower() for ct in cpu_model[4:].split('+')]:
                # Determine numeric ID for each core type, since we need to sort them later numerically
                res = re.search('\d+$', core_type)  # note: numeric ID is expected at the end
                if res:
                    core_id = int(res.group(0))
                    core_types.append((core_id, core_type))
                    self.log.debug("Extracted numeric ID for ARM core type '%s': %s", core_type, core_id)
                else:
                    # Bail out if we can't determine numeric ID
                    core_types = None
                    self.log.debug("Failed to extract numeric ID for ARM core type '%s', bailing out", core_type)
                    break
            if core_types:
                # On big.LITTLE setups, sort core types to have big core (higher model number) first.
                # Example: 'mcpu=cortex-a72.cortex-a53' for "ARM Cortex-A53 + Cortex-A72"
                default_optarch = 'mcpu=%s' % '.'.join([ct[1] for ct in sorted(core_types, reverse=True)])
                self.log.debug("Using architecture-specific compiler optimization flag '%s'", default_optarch)

        return default_optarch
Exemple #5
0
    def _guess_aarch64_default_optarch(self):
        """
        Guess default optarch for AARCH64 (vanilla ARM cores only)
        This heuristic may fail if the CPU module is not supported by the GCC version being used.
        """
        default_optarch = None
        cpu_vendor = systemtools.get_cpu_vendor()
        cpu_model = systemtools.get_cpu_model()

        if cpu_vendor == systemtools.ARM and cpu_model.startswith('ARM '):
            self.log.debug("Determining architecture-specific optimization flag for ARM (model: %s)", cpu_model)
            core_types = []
            for core_type in [ct.strip().lower() for ct in cpu_model[4:].split('+')]:
                # Determine numeric ID for each core type, since we need to sort them later numerically
                res = re.search('\d+$', core_type)  # note: numeric ID is expected at the end
                if res:
                    core_id = int(res.group(0))
                    core_types.append((core_id, core_type))
                    self.log.debug("Extracted numeric ID for ARM core type '%s': %s", core_type, core_id)
                else:
                    # Bail out if we can't determine numeric ID
                    core_types = None
                    self.log.debug("Failed to extract numeric ID for ARM core type '%s', bailing out", core_type)
                    break
            if core_types:
                # On big.LITTLE setups, sort core types to have big core (higher model number) first.
                # Example: 'mcpu=cortex-a72.cortex-a53' for "ARM Cortex-A53 + Cortex-A72"
                default_optarch = 'mcpu=%s' % '.'.join([ct[1] for ct in sorted(core_types, reverse=True)])
                self.log.debug("Using architecture-specific compiler optimization flag '%s'", default_optarch)

        return default_optarch
Exemple #6
0
def get_build_stats(app, starttime):
    """
    Return build statistics for this build
    """

    buildtime = round(time.time() - starttime, 2)
    buildstats = OrderedDict([
                              ('easybuild-framework_version', str(FRAMEWORK_VERSION)),
                              ('easybuild-easyblocks_version', str(EASYBLOCKS_VERSION)),
                              ('host', os.uname()[1]),
                              ('platform' , platform.platform()),
                              ('cpu_model', systemtools.get_cpu_model()),
                              ('core_count', systemtools.get_core_count()),
                              ('timestamp', int(time.time())),
                              ('build_time', buildtime),
                              ('install_size', app.det_installsize()),
                             ])

    return buildstats
def get_build_stats(app, starttime):
    """
    Return build statistics for this build
    """

    buildtime = round(time.time() - starttime, 2)
    buildstats = OrderedDict([
                              ('easybuild-framework_version', str(FRAMEWORK_VERSION)),
                              ('easybuild-easyblocks_version', str(EASYBLOCKS_VERSION)),
                              ('host', os.uname()[1]),
                              ('platform' , platform.platform()),
                              ('cpu_model', systemtools.get_cpu_model()),
                              ('core_count', systemtools.get_core_count()),
                              ('timestamp', int(time.time())),
                              ('build_time', buildtime),
                              ('install_size', app.det_installsize()),
                             ])

    return buildstats
Exemple #8
0
def get_build_stats(app, starttime):
    """
    Return build statistics for this build
    """

    buildtime = round(time.time() - starttime, 2)
    buildstats = OrderedDict(
        [
            ("easybuild-framework_version", str(FRAMEWORK_VERSION)),
            ("easybuild-easyblocks_version", str(EASYBLOCKS_VERSION)),
            ("host", os.uname()[1]),
            ("platform", platform.platform()),
            ("cpu_model", systemtools.get_cpu_model()),
            ("core_count", systemtools.get_core_count()),
            ("timestamp", int(time.time())),
            ("build_time", buildtime),
            ("install_size", app.det_installsize()),
        ]
    )

    return buildstats
def get_build_stats(app, start_time, command_line):
    """
    Return build statistics for this build
    """

    time_now = time.time()
    build_time = round(time_now - start_time, 2)

    buildstats = OrderedDict([
        ('easybuild-framework_version', str(FRAMEWORK_VERSION)),
        ('easybuild-easyblocks_version', str(EASYBLOCKS_VERSION)),
        ('host', os.uname()[1]),
        ('platform', platform.platform()),
        ('cpu_model', get_cpu_model()),
        ('core_count', get_avail_core_count()),
        ('timestamp', int(time_now)),
        ('build_time', build_time),
        ('install_size', app.det_installsize()),
        ('command_line', command_line),
        ('modules_tool', app.modules_tool.buildstats()),
    ])

    return buildstats
Exemple #10
0
 def test_cpu_model(self):
     """Test getting CPU model."""
     cpu_model = get_cpu_model()
     self.assertTrue(isinstance(cpu_model, basestring))
Exemple #11
0
 def test_cpu_model_darwin(self):
     """Test getting CPU model (mocked for Darwin)."""
     st.get_os_type = lambda: st.DARWIN
     st.run_cmd = mocked_run_cmd
     self.assertEqual(get_cpu_model(),
                      "Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz")
 def test_cpu_model_darwin(self):
     """Test getting CPU model (mocked for Darwin)."""
     st.get_os_type = lambda: st.DARWIN
     st.run_cmd = mocked_run_cmd
     self.assertEqual(get_cpu_model(), "Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz")
 def test_cpu_model_native(self):
     """Test getting CPU model."""
     cpu_model = get_cpu_model()
     self.assertTrue(isinstance(cpu_model, basestring))
Exemple #14
0
 def test_cpu_model_native(self):
     """Test getting CPU model."""
     cpu_model = get_cpu_model()
     self.assertTrue(isinstance(cpu_model, string_type))
Exemple #15
0
        perform_step('sanity check', app, lambda x: x.sanitycheck())
        perform_step('cleanup', app, lambda x: x.cleanup())
        perform_step('make module', app, lambda x: x.make_module())

        # remove handler
        app.log.removeHandler(handler)

        if app not in build_stopped:
            # gather build stats
            build_time = round(time.time() - start_time, 2)

            buildstats = {
                          'build_time': build_time,
                          'platform': platform.platform(),
                          'core_count': systemtools.get_core_count(),
                          'cpu_model': systemtools.get_cpu_model(),
                          'install_size': app.installsize(),
                          'timestamp': int(time.time()),
                          'host': os.uname()[1],
                         }
            succes.append((app, buildstats))

    for result in test_results:
        log.info("%s crashed with an error during fase: %s, error: %s" % result)

    failed = len(build_stopped)
    total = len(apps)

    log.info("%s from %s packages failed to build!" % (failed, total))

    output_file = os.path.join(output_dir, "easybuild-test.xml")
Exemple #16
0
            # walk install dir to determine total size
            for dirpath, _, filenames in os.walk(app.installdir):
                for filename in filenames:
                    fullpath = os.path.join(dirpath, filename)
                    if os.path.exists(fullpath):
                        installsize += os.path.getsize(fullpath)
        except OSError, err:
            log.error("Failed to determine install size: %s" % err)

        currentbuildstats = app.getcfg("buildstats")
        buildstats = {
            "build_time": buildtime,
            "platform": platform.platform(),
            "core_count": systemtools.get_core_count(),
            "cpu_model": systemtools.get_cpu_model(),
            "install_size": installsize,
            "timestamp": int(time.time()),
            "host": os.uname()[1],
        }
        log.debug("Build stats: %s" % buildstats)

        if app.getcfg("stop"):
            ended = "STOPPED"
            newLogDir = os.path.join(app.builddir, config.logPath())
        else:
            newLogDir = os.path.join(app.installdir, config.logPath())

            try:
                ## Upload spec to central repository
                repo = getRepository()