Commit 1b345d20 authored by Huff, Israel's avatar Huff, Israel
Browse files

Merge branch 'rsmpbs' of code.ornl.gov:jap/rsm into rsmpbs

parents de42cb8e e21d7dba
Pipeline #100862 passed with stages
in 5 minutes and 16 seconds
variables: variables:
GIT_SUBMODULE_STRATEGY: normal GIT_SUBMODULE_STRATEGY: normal
stages: stages:
- test - test
- analysis - analysis
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "master"
mac_llvm_testing: mac_llvm_testing:
stage: test
tags: tags:
- mac - mac
script: script:
...@@ -28,6 +36,7 @@ mac_llvm_testing: ...@@ -28,6 +36,7 @@ mac_llvm_testing:
-D ExperimentalTest -D ExperimentalTest
linux_gcc_testing: linux_gcc_testing:
stage: test
tags: tags:
- linux - linux
script: script:
...@@ -49,6 +58,13 @@ linux_gcc_testing: ...@@ -49,6 +58,13 @@ linux_gcc_testing:
-D ExperimentalStart -D ExperimentalStart
-D ExperimentalBuild -D ExperimentalBuild
-D ExperimentalTest -D ExperimentalTest
windows_msvc_testing:
stage: test
tags:
- nsmwin10
script:
- ci\windows_testing.bat
linux_analysis: linux_analysis:
stage: analysis stage: analysis
...@@ -79,9 +95,34 @@ linux_analysis: ...@@ -79,9 +95,34 @@ linux_analysis:
-D ExperimentalMemCheck -D ExperimentalMemCheck
-D ExperimentalCoverage -D ExperimentalCoverage
allow_failure: true allow_failure: true
windows_msvc_testing: Linux-fortify:
stage: analysis
tags: tags:
- nsmwin10 - linux
rules:
- when: manual
script: script:
- ci\windows_testing.bat - which git
- git --version
- mkdir build
- cd build
- module load cmake qt/5.9.0 fortify
- export CC="sourceanalyzer -b rsm gcc"
- export CXX="sourceanalyzer -b rsm g++"
- cmake -Drsm_ENABLE_TESTS=OFF
-DOPENSSL_ROOT_DIR=/opt/vendors/openssl/1.1.1d/
-DLibSSH_DIR=/opt/vendors/libssh/0.9.3/lib64/cmake/libssh/
-Drsm_ENABLE_rsmcore=ON
-Drsm_ENABLE_rsmwidgets=OFF ..
## clean after cmake configure
- sourceanalyzer -b rsm -clean
- make
- sourceanalyzer -b rsm -scan -f scanResults.fpr
- ReportGenerator -format PDF -f rsmReport.pdf -source scanResults.fpr -template "DeveloperWorkbook.xml"
- mv rsmReport.pdf ..
artifacts:
paths:
- rsmReport.pdf
expire_in: 1 week
allow_failure: true
...@@ -39,10 +39,12 @@ class ChannelImpl ...@@ -39,10 +39,12 @@ class ChannelImpl
ssh_channel channel = nullptr; ssh_channel channel = nullptr;
explicit ChannelImpl(ssh_session session) explicit ChannelImpl(ssh_session session)
{ {
radix_tagged_line("ChannelImpl::ChannelImpl()");
channel = ssh_channel_new(session); channel = ssh_channel_new(session);
} }
~ChannelImpl() ~ChannelImpl()
{ {
radix_tagged_line("ChannelImpl::~ChannelImpl()");
if (channel != nullptr) if (channel != nullptr)
{ {
ssh_channel_close(channel); ssh_channel_close(channel);
...@@ -101,8 +103,8 @@ QString Channel::readExecOut() ...@@ -101,8 +103,8 @@ QString Channel::readExecOut()
int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 0); int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 0);
if (nbytes > 0) if (nbytes > 0)
{ {
buffer[nbytes] = '\0'; buffer[nbytes - 1] = '\0';
QString result = buffer; QString result = buffer;
return result; return result;
} }
return QString(""); return QString("");
...@@ -114,8 +116,8 @@ QString Channel::readExecErr() ...@@ -114,8 +116,8 @@ QString Channel::readExecErr()
int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 1); int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 1);
if (nbytes > 0) if (nbytes > 0)
{ {
buffer[nbytes] = '\0'; buffer[nbytes - 1] = '\0';
QString result = buffer; QString result = buffer;
return result; return result;
} }
return QString(""); return QString("");
...@@ -699,11 +701,11 @@ SessionAuthState Session::authenticatePrompts(QStringList responses) ...@@ -699,11 +701,11 @@ SessionAuthState Session::authenticatePrompts(QStringList responses)
return state; return state;
} }
Channel Session::newChannel() Channel* Session::newChannel()
{ {
assert_ssh_session(p->session, "newChannel() -- Session is not allocated."); assert_ssh_session(p->session, "newChannel() -- Session is not allocated.");
Channel channel; Channel* channel = new Channel;
channel.p = new ChannelImpl(p->session); channel->p = new ChannelImpl(p->session);
return channel; return channel;
} }
......
...@@ -301,7 +301,7 @@ class RSM_PUBLIC Session ...@@ -301,7 +301,7 @@ class RSM_PUBLIC Session
* @brief newChannel Allocates a new execution channel from this session * @brief newChannel Allocates a new execution channel from this session
* @return * @return
*/ */
Channel newChannel(); Channel* newChannel();
/** /**
* @brief newSFTPSession Allocates a new SFTP session from this SSH session * @brief newSFTPSession Allocates a new SFTP session from this SSH session
......
...@@ -250,10 +250,10 @@ void SessionWorker::authenticatePrompts(QStringList responses) ...@@ -250,10 +250,10 @@ void SessionWorker::authenticatePrompts(QStringList responses)
void SessionWorker::requestExec(QString command) void SessionWorker::requestExec(QString command)
{ {
radix_tagged_line("requestExec(" << command.toStdString() << ")"); radix_tagged_line("requestExec(" << command.toStdString() << ")");
Channel channel = p->session->newChannel(); Channel* channel = p->session->newChannel();
// clear any previous buffer // clear any previous buffer
p->output_buffer.clear(); p->output_buffer.clear();
bool rc = channel.open(); bool rc = channel->open();
if (!rc) if (!rc)
{ {
radix_tagged_line("Failed to open channel"); radix_tagged_line("Failed to open channel");
...@@ -261,35 +261,36 @@ void SessionWorker::requestExec(QString command) ...@@ -261,35 +261,36 @@ void SessionWorker::requestExec(QString command)
return; return;
} }
rc = channel.exec(command); rc = channel->exec(command);
if (!rc) if (!rc)
{ {
radix_tagged_line("Failed to request exec."); radix_tagged_line("Failed to request exec.");
emit execFailed("Failed to execute remote command."); emit execFailed("Failed to execute remote command.");
channel.close(); channel->close();
return; return;
} }
// TODO: should we use timeout or non-blocking version of this call? // TODO: should we use timeout or non-blocking version of this call?
// read stdout // read stdout
QString bytes = channel.readExecOut(); QString bytes = channel->readExecOut();
while (!bytes.isEmpty()) while (!bytes.isEmpty())
{ {
p->output_buffer.append(bytes); p->output_buffer.append(bytes);
bytes = channel.readExecOut(); bytes = channel->readExecOut();
} }
// read stderr // read stderr
bytes = channel.readExecErr(); bytes = channel->readExecErr();
while (!bytes.isEmpty()) while (!bytes.isEmpty())
{ {
p->output_buffer.append(bytes); p->output_buffer.append(bytes);
bytes = channel.readExecErr(); bytes = channel->readExecErr();
} }
emit execOutputReady(); emit execOutputReady();
radix_tagged_line("nbytes=" << p->output_buffer.size()); radix_tagged_line("nbytes=" << p->output_buffer.size());
radix_tagged_line("Finished reading response\n" << p->output_buffer.data()); radix_tagged_line("Finished reading response\n" << p->output_buffer.data());
channel.close(); channel->close();
delete channel;
radix_tagged_line("'" << command.toStdString() << "' finished."); radix_tagged_line("'" << command.toStdString() << "' finished.");
emit execFinished(); emit execFinished();
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#endif #endif
using namespace rsm; using namespace rsm;
TEST(RSM, SessionController) TEST(RSM, DISABLED_SessionController)
{ {
SessionController controller; SessionController controller;
controller.setHost("apollo"); controller.setHost("apollo");
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "rsmcore/sessionworker.hh" #include "rsmcore/sessionworker.hh"
using namespace rsm; using namespace rsm;
TEST(RSM, SessionWorker) TEST(RSM, DISABLED_SessionWorker)
{ {
SessionWorker session("apollo"); SessionWorker session("apollo");
session.setLogVerbosity(SessionVerbosity::None); session.setLogVerbosity(SessionVerbosity::None);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment