Exemple #1
0
    def run_phase(self): # pylint: disable=arguments-differ
    ###########################################################################
        self._activate_case2()
        should_match = (self._case.get_value("DESP_MODE") == "NOCHANGE")
        SystemTestsCompareTwo.run_phase(self, success_change=not should_match)
        # Look for expected coupler restart files
        logger = logging.getLogger(__name__)
        self._activate_case1()
        rundir1 = self._case.get_value("RUNDIR")
        self._activate_case2()
        rundir2 = self._case.get_value("RUNDIR")
        compare_ok = True
        pause_comps = self._case.get_value("PAUSE_COMPONENT_LIST")
        expect((pause_comps != 'none'), "Pause/Resume (PRE) test has no pause components")
        if pause_comps == 'all':
            pause_comps = self._case.get_values("COMP_CLASSES")
        else:
            pause_comps = pause_comps.split(':')

        multi_driver = self._case.get_value("MULTI_DRIVER")

        for comp in pause_comps:
            if comp == "cpl":
                if multi_driver:
                    ninst = self._case.get_value("NINST_MAX")
                else:
                    ninst = 1
            else:
                ninst = self._case.get_value("NINST_{}".format(comp.upper()))

            comp_name = self._case.get_value('COMP_{}'.format(comp.upper()))
            for index in range(1,ninst+1):
                if ninst == 1:
                    rname = '*.{}.r.*'.format(comp_name)
                else:
                    rname = '*.{}_{:04d}.r.*'.format(comp_name, index)

                restart_files_1 = glob.glob(os.path.join(rundir1, rname))
                expect((len(restart_files_1) > 0), "No case1 restart files for {}".format(comp))
                restart_files_2 = glob.glob(os.path.join(rundir2, rname))
                expect((len(restart_files_2) > len(restart_files_1)),
                       "No pause (restart) files found in case2 for {}".format(comp))
                # Do cprnc of restart files.
                rfile1 = restart_files_1[len(restart_files_1) - 1]
                # rfile2 has to match rfile1 (same time string)
                parts = os.path.basename(rfile1).split(".")
                glob_str = "*.{}".format(".".join(parts[len(parts)-4:]))
                restart_files_2 = glob.glob(os.path.join(rundir2, glob_str))
                expect((len(restart_files_2) == 1),
                       "Missing case2 restart file, {}", glob_str)
                rfile2 = restart_files_2[0]
                ok = cprnc(comp, rfile1, rfile2, self._case, rundir2)[0]
                logger.warning("CPRNC result for {}: {}".format(os.path.basename(rfile1), "PASS" if (ok == should_match) else "FAIL"))
                compare_ok = compare_ok and (should_match == ok)

        expect(compare_ok,
               "Not all restart files {}".format("matched" if should_match else "failed to match"))
Exemple #2
0
    def run_phase(self):  # pylint: disable=arguments-differ
        ###########################################################################
        self._activate_case2()
        should_match = (self._case.get_value("DESP_MODE") == "NOCHANGE")
        SystemTestsCompareTwo.run_phase(self, success_change=not should_match)
        # Look for expected coupler restart files
        logger = logging.getLogger(__name__)
        self._activate_case1()
        rundir1 = self._case.get_value("RUNDIR")
        self._activate_case2()
        rundir2 = self._case.get_value("RUNDIR")
        compare_ok = True
        multi_driver = self._case.get_value("MULTI_DRIVER")
        comps = self._case.get_values("COMP_CLASSES")
        for comp in comps:
            if not self._case.get_value("PAUSE_ACTIVE_{}".format(comp)):
                continue
            if comp == "CPL":
                if multi_driver:
                    ninst = self._case.get_value("NINST_MAX")
                else:
                    ninst = 1
            else:
                ninst = self._case.get_value("NINST_{}".format(comp))

            comp_name = self._case.get_value('COMP_{}'.format(comp))
            for index in range(1, ninst + 1):
                if ninst == 1:
                    rname = '*.{}.r.*'.format(comp_name)
                else:
                    rname = '*.{}_{:04d}.r.*'.format(comp_name, index)

                restart_files_1 = glob.glob(os.path.join(rundir1, rname))
                expect((len(restart_files_1) > 0),
                       "No case1 restart files for {}".format(comp))
                restart_files_2 = glob.glob(os.path.join(rundir2, rname))
                expect((len(restart_files_2) > len(restart_files_1)),
                       "No pause (restart) files found in case2 for {}".format(
                           comp))
                # Do cprnc of restart files.
                rfile1 = restart_files_1[len(restart_files_1) - 1]
                # rfile2 has to match rfile1 (same time string)
                parts = os.path.basename(rfile1).split(".")
                glob_str = "*.{}".format(".".join(parts[len(parts) - 4:]))
                restart_files_2 = glob.glob(os.path.join(rundir2, glob_str))
                expect((len(restart_files_2) == 1),
                       "Missing case2 restart file, {}", glob_str)
                rfile2 = restart_files_2[0]
                ok = cprnc(comp, rfile1, rfile2, self._case, rundir2)[0]
                logger.warning("CPRNC result for {}: {}".format(
                    os.path.basename(rfile1), "PASS" if
                    (ok == should_match) else "FAIL"))
                compare_ok = compare_ok and (should_match == ok)

        expect(
            compare_ok, "Not all restart files {}".format(
                "matched" if should_match else "failed to match"))
Exemple #3
0
    def run_phase(self):
        ###########################################################################
        SystemTestsCompareTwo.run_phase(self)
        # Look for expected coupler restart files
        logger = logging.getLogger(__name__)
        self._activate_case1()
        rundir1 = self._case.get_value("RUNDIR")
        self._activate_case2()
        rundir2 = self._case.get_value("RUNDIR")
        should_match = (self._case.get_value("DESP_MODE") == "NOCHANGE")
        compare_ok = True
        pause_comps = self._case.get_value("PAUSE_COMPONENT_LIST")
        expect((pause_comps != 'none'),
               "Pause/Resume (PRE) test has no pause components")
        if pause_comps == 'all':
            pause_comps = self._case.get_values("COMP_CLASSES")
        else:
            pause_comps = pause_comps.split(':')

        for comp in pause_comps:
            comp_name = self._case.get_value('COMP_%s' % comp.upper())
            rname = '*.%s.r.*' % comp_name
            restart_files_1 = glob.glob(os.path.join(rundir1, rname))
            expect((len(restart_files_1) > 0),
                   "No case1 restart files for %s" % comp)
            restart_files_2 = glob.glob(os.path.join(rundir2, rname))
            expect((len(restart_files_2) > len(restart_files_1)),
                   "No pause (restart) files found in case2 for %s" % comp)
            # Do cprnc of restart files.
            rfile1 = restart_files_1[len(restart_files_1) - 1]
            # rfile2 has to match rfile1 (same time string)
            parts = os.path.basename(rfile1).split(".")
            glob_str = "*.%s" % ".".join(parts[len(parts) - 4:])
            restart_files_2 = glob.glob(os.path.join(rundir2, glob_str))
            expect((len(restart_files_2) == 1),
                   "Missing case2 restart file, %s", glob_str)
            rfile2 = restart_files_2[0]
            ok, out = cprnc(comp, rfile1, rfile2, self._case, rundir2)  # pylint: disable=unused-variable
            logger.warning("CPRNC result for %s: %s" %
                           (os.path.basename(rfile1), "PASS" if
                            (ok == should_match) else "FAIL"))
            compare_ok = compare_ok and (should_match == ok)

        expect(
            compare_ok, "Not all restart files %s" %
            ("matched" if should_match else "failed to match"))