From 7b8fddea181a68baa778b7bd40f2d02dde8124e3 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Thu, 21 Apr 2022 16:52:50 +0200 Subject: [PATCH 1/6] Fix SSH tests --- .../Testing/XML/RCSSHServerPortForwarding.xml.in | 1 + .../Testing/XML/SSHServerPortForwarding.xml.in | 1 + .../ParaView/Testing/XML/SimpleRCSSHServer.xml.in | 1 + Clients/ParaView/Testing/XML/SimpleSSHServer.xml.in | 1 + .../Testing/XML/SimpleSSHServerAskPass.xml.in | 1 + .../Testing/XML/SimpleSSHServerTermExec.xml.in | 1 + Clients/ParaView/Testing/XML/server.sh.in | 2 +- Clients/ParaView/Testing/XML/server_rc.sh.in | 2 +- Clients/ParaView/Testing/XML/sshServers.pvsc.in | 12 ++++++------ 9 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Clients/ParaView/Testing/XML/RCSSHServerPortForwarding.xml.in b/Clients/ParaView/Testing/XML/RCSSHServerPortForwarding.xml.in index 04bdd49003..81b3f265c6 100644 --- a/Clients/ParaView/Testing/XML/RCSSHServerPortForwarding.xml.in +++ b/Clients/ParaView/Testing/XML/RCSSHServerPortForwarding.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/SSHServerPortForwarding.xml.in b/Clients/ParaView/Testing/XML/SSHServerPortForwarding.xml.in index 628fab5ece..997e637cd5 100644 --- a/Clients/ParaView/Testing/XML/SSHServerPortForwarding.xml.in +++ b/Clients/ParaView/Testing/XML/SSHServerPortForwarding.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/SimpleRCSSHServer.xml.in b/Clients/ParaView/Testing/XML/SimpleRCSSHServer.xml.in index f2f621bddb..fe74cb11da 100644 --- a/Clients/ParaView/Testing/XML/SimpleRCSSHServer.xml.in +++ b/Clients/ParaView/Testing/XML/SimpleRCSSHServer.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/SimpleSSHServer.xml.in b/Clients/ParaView/Testing/XML/SimpleSSHServer.xml.in index 0c7b2b07a7..3440cbfe88 100644 --- a/Clients/ParaView/Testing/XML/SimpleSSHServer.xml.in +++ b/Clients/ParaView/Testing/XML/SimpleSSHServer.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/SimpleSSHServerAskPass.xml.in b/Clients/ParaView/Testing/XML/SimpleSSHServerAskPass.xml.in index a0328d70ae..b5df27e223 100644 --- a/Clients/ParaView/Testing/XML/SimpleSSHServerAskPass.xml.in +++ b/Clients/ParaView/Testing/XML/SimpleSSHServerAskPass.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/SimpleSSHServerTermExec.xml.in b/Clients/ParaView/Testing/XML/SimpleSSHServerTermExec.xml.in index 9684e8cfdc..eb92880665 100644 --- a/Clients/ParaView/Testing/XML/SimpleSSHServerTermExec.xml.in +++ b/Clients/ParaView/Testing/XML/SimpleSSHServerTermExec.xml.in @@ -6,6 +6,7 @@ + diff --git a/Clients/ParaView/Testing/XML/server.sh.in b/Clients/ParaView/Testing/XML/server.sh.in index 6ead484008..01dad79230 100644 --- a/Clients/ParaView/Testing/XML/server.sh.in +++ b/Clients/ParaView/Testing/XML/server.sh.in @@ -1,4 +1,4 @@ -DISPLAY=:0 @ParaView_BINARY_DIR@/bin/pvserver -sp=$1 2>&1 | tee sshServer.log & +DISPLAY=:0 @ParaView_BINARY_DIR@/bin/pvserver --sp=$1 2>&1 | tee sshServer.log & # DIRTY FIX # Wait 120s for all the SSH test to run, then make sure that all remaining instance of x-terminal-emulator are killed diff --git a/Clients/ParaView/Testing/XML/server_rc.sh.in b/Clients/ParaView/Testing/XML/server_rc.sh.in index a093643d12..af2150042b 100644 --- a/Clients/ParaView/Testing/XML/server_rc.sh.in +++ b/Clients/ParaView/Testing/XML/server_rc.sh.in @@ -1,4 +1,4 @@ -DISPLAY=:0 @ParaView_BINARY_DIR@/bin/pvserver -rc -ch=$1 -sp=$2 2>&1 | tee sshServer.log & +DISPLAY=:0 @ParaView_BINARY_DIR@/bin/pvserver --rc --client-host=$1 --sp=$2 2>&1 | tee sshServer.log & # DIRTY FIX # Wait 120s for all the SSH test to run, then make sure that all remaining instance of x-terminal-emulator are killed diff --git a/Clients/ParaView/Testing/XML/sshServers.pvsc.in b/Clients/ParaView/Testing/XML/sshServers.pvsc.in index b6a1c9fd6e..e0c890b66c 100644 --- a/Clients/ParaView/Testing/XML/sshServers.pvsc.in +++ b/Clients/ParaView/Testing/XML/sshServers.pvsc.in @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -64,7 +64,7 @@ - + -- GitLab From 5b85198220c7a328fb0c41f2fb70d86eca60ac27 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Thu, 21 Apr 2022 16:53:06 +0200 Subject: [PATCH 2/6] Add sanithy checks in load data reaction --- .../pqLoadDataReaction.cxx | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/Qt/ApplicationComponents/pqLoadDataReaction.cxx b/Qt/ApplicationComponents/pqLoadDataReaction.cxx index bfde3434b3..280fdd4b53 100644 --- a/Qt/ApplicationComponents/pqLoadDataReaction.cxx +++ b/Qt/ApplicationComponents/pqLoadDataReaction.cxx @@ -86,6 +86,17 @@ QList pqLoadDataReaction::loadData() QList pqLoadDataReaction::loadData(const ReaderSet& readerSet) { pqServer* server = pqActiveObjects::instance().activeServer(); + if (!server) + { + return QList(); + } + + vtkSMSession* session = server->session(); + if (!session) + { + return QList(); + } + vtkSMReaderFactory* readerFactory = vtkSMProxyManager::GetProxyManager()->GetReaderFactory(); std::vector filtersDetailed = @@ -243,8 +254,14 @@ QVector pqLoadDataReaction::loadFilesForSupportedTypes(QList< QVector pqLoadDataReaction::loadFilesForAllTypes( QList files, pqServer* server, vtkSMReaderFactory* readerFactory) { + vtkSMSession* session = server->session(); + if (!session) + { + return QVector(); + } + QVector newSources; - vtkStringList* list = readerFactory->GetReaders(server->session()); + vtkStringList* list = readerFactory->GetReaders(session); for (QStringList const& fileGroups : files) { pqSelectReaderDialog prompt(fileGroups[0], server, list, pqCoreUtilities::mainWidget()); @@ -408,15 +425,27 @@ pqPipelineSource* pqLoadDataReaction::loadData( bool pqLoadDataReaction::TestFileReadability( const QString& file, pqServer* server, vtkSMReaderFactory* vtkNotUsed(factory)) { - return vtkSMReaderFactory::TestFileReadability(file.toUtf8().data(), server->session()); + vtkSMSession* session = server->session(); + if (!session) + { + return false; + } + + return vtkSMReaderFactory::TestFileReadability(file.toUtf8().data(), session); } //----------------------------------------------------------------------------- bool pqLoadDataReaction::DetermineFileReader(const QString& filename, pqServer* server, vtkSMReaderFactory* factory, QPair& readerInfo) { + vtkSMSession* session = server->session(); + if (!session) + { + return false; + } + QString readerType, readerGroup; - vtkStringList* list = factory->GetReaders(filename.toUtf8().data(), server->session()); + vtkStringList* list = factory->GetReaders(filename.toUtf8().data(), session); if (list->GetLength() > 3) { // If more than one readers found. @@ -487,6 +516,12 @@ pqPipelineSource* pqLoadDataReaction::LoadFile( void pqLoadDataReaction::addReaderToDefaults(QString const& readerName, pqServer* server, vtkSMReaderFactory* readerFactory, QString const& customPattern) { + vtkSMSession* session = server->session(); + if (!session) + { + return; + } + auto pxm = server ? server->proxyManager() : nullptr; auto settingsProxy = pxm ? vtkSMSettingsProxy::SafeDownCast(pxm->GetProxy("settings", "RepresentedArrayListSettings")) @@ -498,7 +533,7 @@ void pqLoadDataReaction::addReaderToDefaults(QString const& readerName, pqServer std::string const readerNameString = readerName.toStdString(); - auto filtersDetailed = readerFactory->GetSupportedFileTypesDetailed(server->session()); + auto filtersDetailed = readerFactory->GetSupportedFileTypesDetailed(session); auto readerIt = std::find_if(filtersDetailed.begin(), filtersDetailed.end(), [&](FileTypeDetailed const& fileType) { return fileType.Name == readerNameString; }); -- GitLab From 593a64ed4c788472c3a815de34dbcc2b747a6db8 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Thu, 21 Apr 2022 17:01:31 +0200 Subject: [PATCH 3/6] Enable SSH testing --- .gitlab/ci/configure_fedora35_shared_mpi_python_qt.cmake | 2 ++ .gitlab/ci/ssh-test-conf.sh | 9 +++++++++ .gitlab/os-linux.yml | 1 + 3 files changed, 12 insertions(+) create mode 100755 .gitlab/ci/ssh-test-conf.sh diff --git a/.gitlab/ci/configure_fedora35_shared_mpi_python_qt.cmake b/.gitlab/ci/configure_fedora35_shared_mpi_python_qt.cmake index 8c17ec7d85..dfbeaec121 100644 --- a/.gitlab/ci/configure_fedora35_shared_mpi_python_qt.cmake +++ b/.gitlab/ci/configure_fedora35_shared_mpi_python_qt.cmake @@ -15,6 +15,8 @@ set(PARAVIEW_PLUGIN_ENABLE_pvNVIDIAIndeX ON CACHE BOOL "") set(PARAVIEW_PLUGIN_ENABLE_CDIReader ON CACHE BOOL "") +set(PARAVIEW_SSH_SERVERS_TESTING ON CACHE BOOL "") + # External package settings. # set(PARAVIEW_BUILD_WITH_EXTERNAL ON CACHE BOOL "") # set(VTK_MODULE_USE_EXTERNAL_ParaView_vtkcatalyst OFF CACHE BOOL "") diff --git a/.gitlab/ci/ssh-test-conf.sh b/.gitlab/ci/ssh-test-conf.sh new file mode 100755 index 0000000000..f9dd8f8aba --- /dev/null +++ b/.gitlab/ci/ssh-test-conf.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# Append own public key as authorized so we can ssh localhost +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys + +# Append ourself to the known hosts to avoid interactive prompt +ssh-keyscan -H localhost >> ~/.ssh/known_hosts +ssh-keyscan -H $HOSTNAME >> ~/.ssh/known_hosts diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 6b5eba2b66..e0b1fa7f94 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -141,6 +141,7 @@ - .gitlab/ci/ninja.sh - .gitlab/ci/doxygen.sh - .gitlab/ci/sccache.sh + - .gitlab/ci/ssh-test-conf.sh - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PWD/.gitlab/doxygen/bin:$PATH - cmake --version - ninja --version -- GitLab From 14e4b975a30103aab2612ed3e58e01d541962ca3 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Tue, 26 Apr 2022 13:52:52 +0200 Subject: [PATCH 4/6] Adding mkdir --- .gitlab/ci/ssh-test-conf.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/ci/ssh-test-conf.sh b/.gitlab/ci/ssh-test-conf.sh index f9dd8f8aba..f8cc2ae9e1 100755 --- a/.gitlab/ci/ssh-test-conf.sh +++ b/.gitlab/ci/ssh-test-conf.sh @@ -2,6 +2,7 @@ set -e # Append own public key as authorized so we can ssh localhost +mkdir ~/.ssh cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys # Append ourself to the known hosts to avoid interactive prompt -- GitLab From a09461b829a69cb7c59661e12c8aaf872ff70f7e Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Tue, 26 Apr 2022 16:35:16 +0200 Subject: [PATCH 5/6] adding ssh keygen --- .gitlab/ci/ssh-test-conf.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/ci/ssh-test-conf.sh b/.gitlab/ci/ssh-test-conf.sh index f8cc2ae9e1..c2dac1ad53 100755 --- a/.gitlab/ci/ssh-test-conf.sh +++ b/.gitlab/ci/ssh-test-conf.sh @@ -3,6 +3,7 @@ set -e # Append own public key as authorized so we can ssh localhost mkdir ~/.ssh +ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N "" cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys # Append ourself to the known hosts to avoid interactive prompt -- GitLab From 936f617fd8f251a478e44073a3a7d5191b8c6bd1 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Wed, 27 Apr 2022 09:35:40 +0200 Subject: [PATCH 6/6] Run server --- .gitlab/ci/ssh-test-conf.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab/ci/ssh-test-conf.sh b/.gitlab/ci/ssh-test-conf.sh index c2dac1ad53..24b4255c3c 100755 --- a/.gitlab/ci/ssh-test-conf.sh +++ b/.gitlab/ci/ssh-test-conf.sh @@ -6,6 +6,9 @@ mkdir ~/.ssh ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N "" cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +# Run ssh server +systemctl start sshd.service + # Append ourself to the known hosts to avoid interactive prompt ssh-keyscan -H localhost >> ~/.ssh/known_hosts ssh-keyscan -H $HOSTNAME >> ~/.ssh/known_hosts -- GitLab