@@ -130,13 +130,35 @@ def execute(self, log, keyvals, testDef):
130130 # check if we need to point to middleware
131131 # do this before we load environment modules so we can append to the list if needed
132132 midpath = False
133+ try :
134+ savebinpath = os .environ ['PATH' ]
135+ except KeyError :
136+ savebinpath = None
137+ try :
138+ savelibpath = os .environ ['LIBRARY_PATH' ]
139+ except KeyError :
140+ savelibpath = None
141+ try :
142+ savecpath = os .environ ['CPATH' ]
143+ except KeyError :
144+ savecpath = None
145+ try :
146+ saveldlibpath = os .environ ['LD_LIBRARY_PATH' ]
147+ except KeyError :
148+ saveldlibpath = None
133149 try :
134150 if cmds ['middleware' ] is not None :
135151 # pass it down
136152 log ['middleware' ] = cmds ['middleware' ]
137- # get the log entry of its location
138- midlog = testDef .logger .getLog (cmds ['middleware' ])
139- if midlog is not None :
153+ # there may be more than one middleware noted here
154+ # so break it apart just in case
155+ # might be comma-delimited or space delimited
156+ mware = re .split ("\s|," , cmds ['middleware' ])
157+ for m in mware :
158+ # get the log entry of its location
159+ midlog = testDef .logger .getLog (m )
160+ if midlog is None :
161+ continue
140162 # get the location of the middleware
141163 try :
142164 if midlog ['location' ] is not None :
@@ -145,7 +167,6 @@ def execute(self, log, keyvals, testDef):
145167 oldbinpath = os .environ ['PATH' ]
146168 pieces = oldbinpath .split (':' )
147169 except KeyError :
148- oldbinpath = ""
149170 pieces = []
150171 bindir = os .path .join (midlog ['location' ], "bin" )
151172 pieces .insert (0 , bindir )
@@ -156,7 +177,6 @@ def execute(self, log, keyvals, testDef):
156177 oldldlibpath = os .environ ['LD_LIBRARY_PATH' ]
157178 pieces = oldldlibpath .split (':' )
158179 except KeyError :
159- oldldlibpath = ""
160180 pieces = []
161181 bindir = os .path .join (midlog ['location' ], "lib" )
162182 pieces .insert (0 , bindir )
@@ -167,7 +187,6 @@ def execute(self, log, keyvals, testDef):
167187 oldcpath = os .environ ['CPATH' ]
168188 pieces = oldcpath .split (':' )
169189 except KeyError :
170- oldcpath = ""
171190 pieces = []
172191 bindir = os .path .join (midlog ['location' ], "include" )
173192 pieces .insert (0 , bindir )
@@ -178,7 +197,6 @@ def execute(self, log, keyvals, testDef):
178197 oldlibpath = os .environ ['LIBRARY_PATH' ]
179198 pieces = oldlibpath .split (':' )
180199 except KeyError :
181- oldlibpath = ""
182200 pieces = []
183201 bindir = os .path .join (midlog ['location' ], "lib" )
184202 pieces .insert (0 , bindir )
@@ -290,7 +308,12 @@ def execute(self, log, keyvals, testDef):
290308 # save the current directory so we can return to it
291309 cwd = os .getcwd ()
292310 # now move to the package location
293- os .chdir (location )
311+ try :
312+ os .chdir (location )
313+ except :
314+ log ['status' ] = 1
315+ return
316+
294317 # see if they want us to execute autogen
295318 try :
296319 if cmds ['autogen_cmd' ] is not None :
@@ -532,10 +555,34 @@ def execute(self, log, keyvals, testDef):
532555
533556 # if we added middleware to the paths, remove it
534557 if midpath :
535- os .environ ['PATH' ] = oldbinpath
536- os .environ ['LD_LIBRARY_PATH' ] = oldldlibpath
537- os .environ ['CPATH' ] = oldcpath
538- os .environ ['LIBRARY_PATH' ] = oldlibpath
558+ if savebinpath is None :
559+ try :
560+ del os .environ ['PATH' ]
561+ except :
562+ pass
563+ else :
564+ os .environ ['PATH' ] = savebinpath
565+ if saveldlibpath is None :
566+ try :
567+ del os .environ ['LD_LIBRARY_PATH' ]
568+ except :
569+ pass
570+ else :
571+ os .environ ['LD_LIBRARY_PATH' ] = saveldlibpath
572+ if savecpath is None :
573+ try :
574+ del os .environ ['CPATH' ]
575+ except :
576+ pass
577+ else :
578+ os .environ ['CPATH' ] = savecpath
579+ if savelibpath is None :
580+ try :
581+ del os .environ ['LIBRARY_PATH' ]
582+ except :
583+ pass
584+ else :
585+ os .environ ['LIBRARY_PATH' ] = savelibpath
539586
540587 # Add confirmation that build is complete
541588 try :
0 commit comments