Library OperatingSystem
Library BuiltIn
Library Process
-Resource variables.resource
-Suite Setup Open Connection And Log In
-Suite Teardown Close All Connections
+Suite Setup Run Keywords
+... Open Connection And Log In
+... Install LTP
+Test Teardown Download Logs
+Suite Teardown Run Keywords
+... Uninstall LTP
+... Close All Connections
*** Variables ***
-${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log
-
+${FULL_SUITE} ${SUITE_NAME.replace(' ','_')}
*** Test Cases ***
-#Run whole ltp test suite
-# [Documentation] Wait ~5hrs to complete 2536 tests
-# ${result}= Run Process ./runltp shell=yes cwd=/opt/ltp stdout=${LOG}
-# Append To File ${LOG} ${result}${\n}
-# Sleep 2s
-# Should Contain ${result.stdout} failed 0
-
-#Run ltp syscalls test suite
-# [Documentation] Wait ~45m for syscalls to complete
-# ${result}= Run Process ./runltp -f syscalls shell=yes cwd=/opt/ltp stdout=${LOG}
-# Append To File ${LOG} ${result}${\n}
-# Sleep 2s
-# Should Contain ${result.stdout} failed 0
-
-Run ltp syscalls madvise
+# Plese maintain shortest job first order
+RunLTP syscalls madvise only
[Documentation] Wait ~1m for madvise01-10 to complete
- ${result}= Run Process ./runltp -f syscalls -s madvise shell=yes cwd=/opt/ltp stdout=${LOG}
- Append To File ${LOG} ${result}${\n}
- Sleep 2s
- Should Contain ${result.stdout} failed 0
+ ${log} = Set Variable ${OUTPUT DIR}${/}${FULL_SUITE}.${TEST NAME.replace(' ','_')}.log
+ ${result}= Execute Command yes | sudo /opt/ltp/runltp -f syscalls -s madvise
+ Append To File ${log} ${result}${\n}
+ Should Contain ${result} INFO: ltp-pan reported all tests PASS
+
+RunLTP syscalls only
+ [Documentation] Wait ~45m for syscalls to complete
+ ${log} = Set Variable ${OUTPUT DIR}${/}${FULL_SUITE}.${TEST NAME.replace(' ','_')}.log
+ ${result}= Execute Command yes | sudo /opt/ltp/runltp -f syscalls
+ Append To File ${log} ${result}${\n}
+ Should Contain ${result} INFO: ltp-pan reported all tests PASS
*** Keywords ***
Open Connection And Log In
- Open Connection ${HOST}
- Login ${ROOTUSER} ${ROOTPSWD}
+ Open Connection ${HOST}
+ Login With Public Key ${USERNAME} ${SSH_KEYFILE}
+
+Install LTP
+ Put File /opt/akraino/ltp.tar.gz /tmp/ltp.tar.gz
+ Execute Command tar -xf /tmp/ltp.tar.gz -C / sudo=true
+
+Uninstall LTP
+ Execute Command rm -rf /opt/ltp sudo=True
+ Execute Command rm /tmp/ltp.tar.gz
+Download Logs
+ Execute Command chmod -R a+r /opt/ltp/output sudo=True
+ SSHLibrary.Get File /opt/ltp/output/* ${OUTPUT DIR}/output/
+ Execute Command rm -rf /opt/ltp/output/* sudo=True
+ Execute Command chmod -R a+r /opt/ltp/results sudo=True
+ SSHLibrary.Get File /opt/ltp/results/* ${OUTPUT DIR}/results/
+ Execute Command rm -rf /opt/ltp/results/* sudo=True
\ No newline at end of file
public ValidationDbTestResult getResult(@Nonnull String name, @Nonnull String version, @Nonnull String siloText,
@Nonnull String timestamp)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation nexus test result");
WebResource webResource = this.client.resource(nexusUrl + "/");
public List<ValidationDbTestResult> getResults(@Nonnull String name, @Nonnull String version,
@Nonnull String siloText, int noOfLastElements)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus test results");
WebResource webResource = this.client.resource(nexusUrl + "/");
vDbResult.setTimestamp(timestamp);
vDbResults.add(vDbResult);
}
- } catch (IllegalArgumentException | HttpException | NullPointerException | NoSuchElementException ex) {
+ } catch (HttpException | RuntimeException ex) {
LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving timestamp : "
+ timestamp + " result." + UserUtils.getStackTrace(ex));
continue;
public List<ValidationDbTestResult> getResults(@Nonnull String name, @Nonnull String version,
@Nonnull String siloText, @Nonnull Date date)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
LOGGER.debug(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus results based on date");
WebResource webResource = this.client.resource(nexusUrl + "/");
timestamp = timestamp.substring(0, timestamp.length() - 1);
ValidationDbTestResult vDbResult = this.getResult(name, version, siloText, timestamp);
vDbResults.add(vDbResult);
- } catch (IllegalArgumentException | HttpException | NullPointerException ex) {
+ } catch (HttpException | RuntimeException ex) {
LOGGER.warn(EELFLoggerDelegate.auditLogger,
"Exception occured while retrieving timestamp results. " + UserUtils.getStackTrace(ex));
continue;
public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
@Nonnull String siloText, List<String> layers, Boolean optional, boolean outcome)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome");
WebResource webResource = this.client.resource(nexusUrl + "/");
}
}
return vDbResult;
- } catch (IllegalArgumentException | HttpException | NullPointerException ex) {
+ } catch (HttpException | RuntimeException ex) {
LOGGER.warn(EELFLoggerDelegate.auditLogger,
"Error when trying to retrieve results. " + UserUtils.getStackTrace(ex));
continue;
public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
@Nonnull String siloText, Boolean allLayers, Boolean optional, boolean outcome)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome");
WebResource webResource = this.client.resource(nexusUrl + "/");
continue;
}
return vDbResult;
- } catch (IllegalArgumentException | HttpException | NullPointerException ex) {
+ } catch (HttpException | RuntimeException ex) {
LOGGER.warn(EELFLoggerDelegate.auditLogger,
"Error when trying to retrieve results. " + UserUtils.getStackTrace(ex));
continue;
public List<WRobotNexusTestResult> getWRobotTestResults(@Nonnull String name, @Nonnull String version,
@Nonnull String siloText, @Nonnull String timestamp)
- throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
- IOException, KeyManagementException, NoSuchAlgorithmException {
+ throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
+ IOException, KeyManagementException, NoSuchAlgorithmException {
String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version + "/"
+ timestamp + "/results";
List<WRobotNexusTestResult> listOfwrappers = new ArrayList<WRobotNexusTestResult>();
continue;
}
List<RobotTestResult> robotTestResults = getRobotTestResults(nexusUrl + "/" + layer);
+ if (robotTestResults.size() < 1) {
+ continue;
+ }
WRobotNexusTestResult wrapper = new WRobotNexusTestResult();
wrapper.setLayer(layer);
wrapper.setRobotNexusTestResults(robotTestResults);
List<Element> elements = document.getElementsByTag("body").get(0).getElementsByTag("table").get(0)
.getElementsByTag("tbody").get(0).getElementsByTag("tr");
for (int i = 2; i < elements.size(); i++) {
- String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
- testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1);
- webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml");
- LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
- response = webResource.get(ClientResponse.class);
- if (response.getStatus() != 200) {
- throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : "
- + response.getStatus() + " and message: " + response.getEntity(String.class));
+ try {
+ String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0)
+ .text();
+ testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1);
+ webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml");
+ LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
+ response = webResource.get(ClientResponse.class);
+ if (response.getStatus() != 200) {
+ throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : "
+ + response.getStatus() + " and message: " + response.getEntity(String.class));
+ }
+ String result = response.getEntity(String.class);
+ JSONObject xmlJSONObj = XML.toJSONObject(result);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ RobotTestResult robotTestResult = mapper.readValue(xmlJSONObj.toString(), RobotTestResult.class);
+ robotTestResult.setName(testSuiteName);
+ rTestResults.add(robotTestResult);
+ } catch (Exception ex) {
+ LOGGER.warn(EELFLoggerDelegate.auditLogger,
+ "Exception occured while retrieving robot results. " + UserUtils.getStackTrace(ex));
+ continue;
}
- String result = response.getEntity(String.class);
- JSONObject xmlJSONObj = XML.toJSONObject(result);
- ObjectMapper mapper = new ObjectMapper();
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
- mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
- mapper.setSerializationInclusion(Include.NON_NULL);
- RobotTestResult robotTestResult = mapper.readValue(xmlJSONObj.toString(), RobotTestResult.class);
- robotTestResult.setName(testSuiteName);
- rTestResults.add(robotTestResult);
}
return rTestResults;
}