diff --git a/pylib/Stages/TestRun/PMIxUnit.py b/pylib/Stages/TestRun/PMIxUnit.py index 11601de9a..63b75524d 100644 --- a/pylib/Stages/TestRun/PMIxUnit.py +++ b/pylib/Stages/TestRun/PMIxUnit.py @@ -28,6 +28,8 @@ # @param modules_swap Modules to swap # @param timeout Time limit for application execution # @param dependencies Middleware dependencies +# @param subdir Subdirectory where tests are located +# @param parent Stage that built the tests # @} class PMIxUnit(TestRunMTTStage): @@ -43,6 +45,8 @@ def __init__(self): self.options['modules_swap'] = (None, "Modules to swap") self.options['timeout'] = (None, "Time limit for application execution") self.options['dependencies'] = (None, "Middleware dependencies") + self.options['subdir'] = (None, "Subdirectory where tests are located") + self.options['parent'] = (None, "Stage that built the tests") self.testDef = None self.cmds = None return @@ -86,11 +90,6 @@ def execute(self, log, keyvals, testDef): else: mykeyvals[k] = keyvals[k] - # parse any provided options - these will override the defaults - cmds = {} - testDef.parseOptions(log, self.options, mykeyvals, cmds) - self.cmds = cmds - # check the log for the title so we can # see if this is setting our default behavior try: @@ -117,10 +116,15 @@ def execute(self, log, keyvals, testDef): log['stderr'] = "Section not specified" return + # parse any provided options - these will override the defaults + cmds = {} + testDef.parseOptions(log, self.options, mykeyvals, cmds) + self.cmds = cmds + # must be executing a test of some kind - the install stage # must be specified so we can find the tests to be run try: - parent = keyvals['parent'] + parent = cmds['parent'] except KeyError: log['status'] = 1 log['stderr'] = "Parent test install stage was not provided" @@ -227,7 +231,7 @@ def execute(self, log, keyvals, testDef): break # mark that this was done midpath = True - except KeyError: + except: # if it was already installed, then no location would be provided pass @@ -298,8 +302,12 @@ def execute(self, log, keyvals, testDef): # to change to the test location and begin executing, first saving # our current location so we can return when done cwd = os.getcwd() + try: + if cmds['subdir'] is not None: + location = os.path.join(location, cmds['subdir']) + except: + pass os.chdir(location) - testDef.logger.verbose_print("PMIxUnit: looking for tests in " + location) # cycle thru the list of tests and execute each of them diff --git a/pylib/Tools/Build/Autotools.py b/pylib/Tools/Build/Autotools.py index 0955d5a7b..c3815ab20 100644 --- a/pylib/Tools/Build/Autotools.py +++ b/pylib/Tools/Build/Autotools.py @@ -130,13 +130,35 @@ def execute(self, log, keyvals, testDef): # check if we need to point to middleware # do this before we load environment modules so we can append to the list if needed midpath = False + try: + savebinpath = os.environ['PATH'] + except KeyError: + savebinpath = None + try: + savelibpath = os.environ['LIBRARY_PATH'] + except KeyError: + savelibpath = None + try: + savecpath = os.environ['CPATH'] + except KeyError: + savecpath = None + try: + saveldlibpath = os.environ['LD_LIBRARY_PATH'] + except KeyError: + saveldlibpath = None try: if cmds['middleware'] is not None: # pass it down log['middleware'] = cmds['middleware'] - # get the log entry of its location - midlog = testDef.logger.getLog(cmds['middleware']) - if midlog is not None: + # there may be more than one middleware noted here + # so break it apart just in case + # might be comma-delimited or space delimited + mware = re.split("\s|,", cmds['middleware']) + for m in mware: + # get the log entry of its location + midlog = testDef.logger.getLog(m) + if midlog is None: + continue # get the location of the middleware try: if midlog['location'] is not None: @@ -145,7 +167,6 @@ def execute(self, log, keyvals, testDef): oldbinpath = os.environ['PATH'] pieces = oldbinpath.split(':') except KeyError: - oldbinpath = "" pieces = [] bindir = os.path.join(midlog['location'], "bin") pieces.insert(0, bindir) @@ -156,7 +177,6 @@ def execute(self, log, keyvals, testDef): oldldlibpath = os.environ['LD_LIBRARY_PATH'] pieces = oldldlibpath.split(':') except KeyError: - oldldlibpath = "" pieces = [] bindir = os.path.join(midlog['location'], "lib") pieces.insert(0, bindir) @@ -167,7 +187,6 @@ def execute(self, log, keyvals, testDef): oldcpath = os.environ['CPATH'] pieces = oldcpath.split(':') except KeyError: - oldcpath = "" pieces = [] bindir = os.path.join(midlog['location'], "include") pieces.insert(0, bindir) @@ -178,7 +197,6 @@ def execute(self, log, keyvals, testDef): oldlibpath = os.environ['LIBRARY_PATH'] pieces = oldlibpath.split(':') except KeyError: - oldlibpath = "" pieces = [] bindir = os.path.join(midlog['location'], "lib") pieces.insert(0, bindir) @@ -290,7 +308,12 @@ def execute(self, log, keyvals, testDef): # save the current directory so we can return to it cwd = os.getcwd() # now move to the package location - os.chdir(location) + try: + os.chdir(location) + except: + log['status'] = 1 + return + # see if they want us to execute autogen try: if cmds['autogen_cmd'] is not None: @@ -532,10 +555,34 @@ def execute(self, log, keyvals, testDef): # if we added middleware to the paths, remove it if midpath: - os.environ['PATH'] = oldbinpath - os.environ['LD_LIBRARY_PATH'] = oldldlibpath - os.environ['CPATH'] = oldcpath - os.environ['LIBRARY_PATH'] = oldlibpath + if savebinpath is None: + try: + del os.environ['PATH'] + except: + pass + else: + os.environ['PATH'] = savebinpath + if saveldlibpath is None: + try: + del os.environ['LD_LIBRARY_PATH'] + except: + pass + else: + os.environ['LD_LIBRARY_PATH'] = saveldlibpath + if savecpath is None: + try: + del os.environ['CPATH'] + except: + pass + else: + os.environ['CPATH'] = savecpath + if savelibpath is None: + try: + del os.environ['LIBRARY_PATH'] + except: + pass + else: + os.environ['LIBRARY_PATH'] = savelibpath # Add confirmation that build is complete try: