diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 4db4ec0b2d..1277e0d483 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -31,6 +31,9 @@ def testXMLFile = params.pythonTestXmlFile // Name of the test stage def testStageName = params.pipelineTestStageName +// Name of the phone resource +def ciSmartPhoneResource = params.smartphonesResource + // Terminate Status def termUE = 0 def termENB = 1 @@ -70,6 +73,7 @@ pipeline { string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run') string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage') booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact') + string(name: 'smartphonesResource', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource') //eNB parameters string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB') @@ -112,6 +116,9 @@ pipeline { testStageName = 'Template Test Stage' } + if (params.smartphonesResource == null) { + allParametersPresent = false + } if (params.eNB_IPAddress == null) { allParametersPresent = false } @@ -178,6 +185,7 @@ pipeline { steps { script { dir ('ci-scripts') { + lock (ciSmartPhoneResource) { try { echo "\u2705 \u001B[32m${testStageName}\u001B[0m" withCredentials([ @@ -190,6 +198,7 @@ pipeline { } catch (Exception e) { currentBuild.result = 'FAILURE' } + } } } } diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh index a18fc67c75..61cbf12560 100755 --- a/ci-scripts/checkCodingFormattingRules.sh +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -120,21 +120,34 @@ echo "Source Branch is : $SOURCE_BRANCH" echo "Target Branch is : $TARGET_BRANCH" echo "Merged Commit is : $MERGE_COMMMIT" echo "Target Init is : $TARGET_INIT_COMMIT" +echo "" +echo " ----------------------------------------------------------" +echo "" # Retrieve the list of modified files since the latest develop commit MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq` NB_TO_FORMAT=0 +if [ -f oai_rules_result_list.txt ] +then + rm -f oai_rules_result_list.txt +fi for FULLFILE in $MODIFIED_FILES do - echo $FULLFILE filename=$(basename -- "$FULLFILE") EXT="${filename##*.}" if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ] then TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted ` NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT)) + if [ $TO_FORMAT -ne 0 ] + then + echo $FULLFILE + echo $FULLFILE >> ./oai_rules_result_list.txt + fi fi done +echo "" +echo " ----------------------------------------------------------" echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT" echo $NB_TO_FORMAT > ./oai_rules_result.txt diff --git a/ci-scripts/main.py b/ci-scripts/main.py index f210fd4518..589f389850 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -90,38 +90,50 @@ class SSHConnection(): self.htmlUEConnected = 0 def open(self, ipaddress, username, password): - self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5) - self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) - if self.sshresponse == 0: - self.ssh.sendline('yes') - self.ssh.expect('password:') - self.ssh.sendline(password) - self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + count = 0 + connect_status = False + while count < 4: + self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5) + self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) if self.sshresponse == 0: - pass + self.ssh.sendline('yes') + self.ssh.expect('password:') + self.ssh.sendline(password) + self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if self.sshresponse == 0: + count = 10 + connect_status = True + else: + logging.debug('self.sshresponse = ' + str(self.sshresponse)) + elif self.sshresponse == 1: + self.ssh.sendline(password) + self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if self.sshresponse == 0: + count = 10 + connect_status = True + else: + logging.debug('self.sshresponse = ' + str(self.sshresponse)) + elif self.sshresponse == 2: + # Checking if we are really on the remote client defined by its IP address + self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:"', '\$', 5) + result = re.search(str(ipaddress), str(self.ssh.before)) + if result is None: + self.close() + else: + count = 10 + connect_status = True else: + # debug output + logging.debug(str(self.ssh.before)) logging.debug('self.sshresponse = ' + str(self.sshresponse)) - sys.exit('SSH Connection Failed') - elif self.sshresponse == 1: - self.ssh.sendline(password) - self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if self.sshresponse == 0: - pass - else: - logging.debug('self.sshresponse = ' + str(self.sshresponse)) - sys.exit('SSH Connection Failed') - elif self.sshresponse == 2: - # Checking if we are really on the remote client defined by its IP address - self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:"', '\$', 5) - result = re.search(str(ipaddress), str(self.ssh.before)) - if result is None: - sys.exit('SSH Connection Failed: TIMEOUT !!!') + # adding a tempo when failure + if not connect_status: + time.sleep(1) + count += 1 + if connect_status: pass else: - # debug output - logging.debug(str(self.ssh.before)) - logging.debug('self.sshresponse = ' + str(self.sshresponse)) - sys.exit('SSH Connection Failed!!!') + sys.exit('SSH Connection Failed') def command(self, commandline, expectedline, timeout): logging.debug(commandline) diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 609af5f166..ea2cc5e44f 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -260,7 +260,7 @@ function sca_summary_table_footer { echo " " >> ./build_results.html echo " " >> ./build_results.html echo "
Full details in zipped artifact (cppcheck/cppcheck.xml)
" >> ./build_results.html - echo "Graphical Interface tool : cppcheck-gui -l cppcheck/cppcheck.xml
Graphical Interface tool : cppcheck-gui -l cppcheck/cppcheck.xml
Please apply the following command to this(ese) file(s):
" >> ./build_results.html + echo "astyle --options=ci-scripts/astyle-options.txt filename(s)