Changeset 55590 in vbox for trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
- Timestamp:
- May 1, 2015 8:24:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r55535 r55590 1134 1134 break; 1135 1135 try: 1136 for (_, aEnv) in enumerate(curTest.aEnv): # Enumerate only will work with a sequence (e.g > 1 entries).1136 for (_, aEnv) in enumerate(curTest.aEnv): 1137 1137 aElems = aEnv.split('='); 1138 strKey = ''; 1138 strKey = ''; ## @todo s/Key/Var/g 1139 1139 strValue = ''; 1140 1140 if len(aElems) > 0: … … 1142 1142 if len(aElems) == 2: 1143 1143 strValue = aElems[1]; 1144 reporter.log2('Test #%d: Single key="%s", value="%s" (%d) ...' \1144 reporter.log2('Test #%d: Single var="%s", value="%s" (%d) ...' \ 1145 1145 % (i, strKey, strValue, len(aElems))); 1146 1146 try: … … 1157 1157 else: 1158 1158 reporter.log('Test #%d: API reported an error (single), good' % (i,)); 1159 reporter.log2('Getting key="%s" ...' % (strKey,)); 1160 try: 1161 strValue2 = curGuestSession.environmentGet(strKey); 1162 if strKey.isalnum() \ 1163 and strValue != strValue2: 1164 reporter.error('Test #%d failed: Got environment variable "%s", expected "%s" (key: "%s")' \ 1165 % (i, strValue2, strValue, strKey)); 1166 fRc = False; 1167 break; 1168 # Getting back an empty value when specifying an invalid key is fine. 1169 reporter.log2('Got key "%s=%s"' % (strKey, strValue2)); 1170 except UnicodeDecodeError: # Might happen on unusal values, fine. 1171 if strValue != strValue2: 1172 reporter.error('Test #%d failed: Got (undecoded) environment variable "%s", ' \ 1173 'expected "%s" (key: "%s")' \ 1174 % (i, strValue2, strValue, strKey)); 1175 fRc = False; 1176 break; 1177 except: 1178 if strKey == "" \ 1179 or not strKey.isalnum(): 1180 reporter.log('Test #%d: API reported an error (invalid key "%s"), good' % (i, strKey)); 1181 else: 1182 reporter.errorXcpt('Test #%d failed: Getting environment variable:' % (i)); 1159 ## @todo environmentGet() has been removed in 5.0 because it's not up to the task of returning all the 1160 ## putenv strings forms and gives the impression that the envrionment is something it isn't. This test 1161 ## should be rewritten using the attribute. What's more, there should be an Unset test here, shouldn't 1162 ## there? 1163 # 1164 #reporter.log2('Getting key="%s" ...' % (strKey,)); 1165 #try: 1166 # strValue2 = curGuestSession.environmentGet(strKey); 1167 # if strKey.isalnum() \ 1168 # and strValue != strValue2: 1169 # reporter.error('Test #%d failed: Got environment value "%s", expected "%s" (var: "%s")' \ 1170 # % (i, strValue2, strValue, strKey)); 1171 # fRc = False; 1172 # break; 1173 # # Getting back an empty value when specifying an invalid key is fine. 1174 # reporter.log2('Got key "%s=%s"' % (strKey, strValue2)); 1175 #except UnicodeDecodeError: # Might happen on unusal values, fine. 1176 # if strValue != strValue2: 1177 # reporter.error('Test #%d failed: Got (undecoded) environment variable "%s", ' \ 1178 # 'expected "%s" (var: "%s")' \ 1179 # % (i, strValue2, strValue, strKey)); 1180 # fRc = False; 1181 # break; 1182 #except: 1183 # if strKey == "" \ 1184 # or not strKey.isalnum(): 1185 # reporter.log('Test #%d: API reported an error (invalid key "%s"), good' % (i, strKey)); 1186 # else: 1187 # reporter.errorXcpt('Test #%d failed: Getting environment variable:' % (i)); 1183 1188 if fRc is False: 1184 1189 continue; … … 1209 1214 fRc = False; 1210 1215 break; 1211 curGuestSession.environmentClear(); # No return (e.g. boolean) value available thru wrapper. 1216 1217 self.oTstDrv.oVBoxMgr.setArray(curGuestSession, 'environment', []); 1212 1218 curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, 'environment'); 1213 1219 if len(curEnv) is not 0:
Note:
See TracChangeset
for help on using the changeset viewer.