Merge "Change the criticality of OS security test"
[validation.git] / tests / os / ltp / ltp.robot
1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property.                             #
3 # Copyright (c) 2019 Nokia.                                                  #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License");            #
6 # you maynot use this file except in compliance with the License.            #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18 *** Settings ***
19 Documentation     Validation, robustness and stability of Linux
20 Library           SSHLibrary
21 Library           OperatingSystem
22 Library           BuiltIn
23 Library           Process
24 Suite Setup       Run Keywords
25 ...               Open Connection And Log In
26 ...               Install LTP
27 Test Teardown     Download Logs
28 Suite Teardown    Run Keywords
29 ...               Uninstall LTP
30 ...               Close All Connections
31
32 *** Variables ***
33 ${FULL_SUITE}            ${SUITE_NAME.replace(' ','_')}
34
35 *** Test Cases ***
36 # Plese maintain shortest job first order
37 RunLTP syscalls madvise only
38     [Documentation]         Wait ~1m for madvise01-10 to complete
39     ${log} =  Set Variable  ${OUTPUT DIR}${/}${FULL_SUITE}.${TEST NAME.replace(' ','_')}.log
40     ${result}=              Execute Command  yes | sudo /opt/ltp/runltp -f syscalls -s madvise
41     Append To File          ${log}  ${result}${\n}
42     Should Contain          ${result}    INFO: ltp-pan reported all tests PASS
43
44 RunLTP syscalls only
45     [Documentation]         Wait ~45m for syscalls to complete
46     ${log} =  Set Variable  ${OUTPUT DIR}${/}${FULL_SUITE}.${TEST NAME.replace(' ','_')}.log
47     ${result}=              Execute Command  yes | sudo /opt/ltp/runltp -f syscalls
48     Append To File          ${log}  ${result}${\n}
49     Should Contain          ${result}    INFO: ltp-pan reported all tests PASS
50
51 *** Keywords ***
52 Open Connection And Log In
53     Open Connection        ${HOST}
54     Login With Public Key  ${USERNAME}  ${SSH_KEYFILE}
55
56 Install LTP
57     Put File  /opt/akraino/ltp.tar.gz  /tmp/ltp.tar.gz
58     Execute Command  tar -xf /tmp/ltp.tar.gz -C /  sudo=true
59
60 Uninstall LTP
61     Execute Command  rm -rf /opt/ltp  sudo=True
62     Execute Command  rm /tmp/ltp.tar.gz
63
64 Download Logs
65     Execute Command  chmod -R a+r /opt/ltp/output  sudo=True
66     SSHLibrary.Get File  /opt/ltp/output/*  ${OUTPUT DIR}/output/
67     Execute Command  rm -rf /opt/ltp/output/*  sudo=True
68     Execute Command  chmod -R a+r /opt/ltp/results  sudo=True
69     SSHLibrary.Get File  /opt/ltp/results/*  ${OUTPUT DIR}/results/
70     Execute Command  rm -rf /opt/ltp/results/*  sudo=True