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

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:
GIT_SUBMODULE_STRATEGY: normal
stages:
- test
- analysis
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "master"
mac_llvm_testing:
stage: test
tags:
- mac
script:
......@@ -28,6 +36,7 @@ mac_llvm_testing:
-D ExperimentalTest
linux_gcc_testing:
stage: test
tags:
- linux
script:
......@@ -49,6 +58,13 @@ linux_gcc_testing:
-D ExperimentalStart
-D ExperimentalBuild
-D ExperimentalTest
windows_msvc_testing:
stage: test
tags:
- nsmwin10
script:
- ci\windows_testing.bat
linux_analysis:
stage: analysis
......@@ -79,9 +95,34 @@ linux_analysis:
-D ExperimentalMemCheck
-D ExperimentalCoverage
allow_failure: true
windows_msvc_testing:
Linux-fortify:
stage: analysis
tags:
- nsmwin10
- linux
rules:
- when: manual
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
ssh_channel channel = nullptr;
explicit ChannelImpl(ssh_session session)
{
radix_tagged_line("ChannelImpl::ChannelImpl()");
channel = ssh_channel_new(session);
}
~ChannelImpl()
{
radix_tagged_line("ChannelImpl::~ChannelImpl()");
if (channel != nullptr)
{
ssh_channel_close(channel);
......@@ -101,8 +103,8 @@ QString Channel::readExecOut()
int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 0);
if (nbytes > 0)
{
buffer[nbytes] = '\0';
QString result = buffer;
buffer[nbytes - 1] = '\0';
QString result = buffer;
return result;
}
return QString("");
......@@ -114,8 +116,8 @@ QString Channel::readExecErr()
int nbytes = ssh_channel_read(p->channel, buffer, sizeof(buffer), 1);
if (nbytes > 0)
{
buffer[nbytes] = '\0';
QString result = buffer;
buffer[nbytes - 1] = '\0';
QString result = buffer;
return result;
}
return QString("");
......@@ -699,11 +701,11 @@ SessionAuthState Session::authenticatePrompts(QStringList responses)
return state;
}
Channel Session::newChannel()
Channel* Session::newChannel()
{
assert_ssh_session(p->session, "newChannel() -- Session is not allocated.");
Channel channel;
channel.p = new ChannelImpl(p->session);
Channel* channel = new Channel;
channel->p = new ChannelImpl(p->session);
return channel;
}
......
......@@ -301,7 +301,7 @@ class RSM_PUBLIC Session
* @brief newChannel Allocates a new execution channel from this session
* @return
*/
Channel newChannel();
Channel* newChannel();
/**
* @brief newSFTPSession Allocates a new SFTP session from this SSH session
......
......@@ -250,10 +250,10 @@ void SessionWorker::authenticatePrompts(QStringList responses)
void SessionWorker::requestExec(QString command)
{
radix_tagged_line("requestExec(" << command.toStdString() << ")");
Channel channel = p->session->newChannel();
Channel* channel = p->session->newChannel();
// clear any previous buffer
p->output_buffer.clear();
bool rc = channel.open();
bool rc = channel->open();
if (!rc)
{
radix_tagged_line("Failed to open channel");
......@@ -261,35 +261,36 @@ void SessionWorker::requestExec(QString command)
return;
}
rc = channel.exec(command);
rc = channel->exec(command);
if (!rc)
{
radix_tagged_line("Failed to request exec.");
emit execFailed("Failed to execute remote command.");
channel.close();
channel->close();
return;
}
// TODO: should we use timeout or non-blocking version of this call?
// read stdout
QString bytes = channel.readExecOut();
QString bytes = channel->readExecOut();
while (!bytes.isEmpty())
{
p->output_buffer.append(bytes);
bytes = channel.readExecOut();
bytes = channel->readExecOut();
}
// read stderr
bytes = channel.readExecErr();
bytes = channel->readExecErr();
while (!bytes.isEmpty())
{
p->output_buffer.append(bytes);
bytes = channel.readExecErr();
bytes = channel->readExecErr();
}
emit execOutputReady();
radix_tagged_line("nbytes=" << p->output_buffer.size());
radix_tagged_line("Finished reading response\n" << p->output_buffer.data());
channel.close();
channel->close();
delete channel;
radix_tagged_line("'" << command.toStdString() << "' finished.");
emit execFinished();
}
......
......@@ -8,7 +8,7 @@
#endif
using namespace rsm;
TEST(RSM, SessionController)
TEST(RSM, DISABLED_SessionController)
{
SessionController controller;
controller.setHost("apollo");
......
......@@ -4,7 +4,7 @@
#include "rsmcore/sessionworker.hh"
using namespace rsm;
TEST(RSM, SessionWorker)
TEST(RSM, DISABLED_SessionWorker)
{
SessionWorker session("apollo");
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