From 766904bf5b776a6437ca974efbeb9e99ef13e084 Mon Sep 17 00:00:00 2001 From: Tatiana Borisova Date: Mon, 6 Sep 2021 10:11:06 +0300 Subject: Compile autotests for Integrity - process environment/DNS are OFF for INTEGRITY Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I189a97f88c96a428586c31a66b8d250e04482900 Reviewed-by: Edward Welbourne --- .../kernel/qprinterinfo/tst_qprinterinfo.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'tests/auto/printsupport/kernel/qprinterinfo') diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index 01e63af082..ebe0990164 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -33,10 +33,11 @@ #include -#ifdef Q_OS_UNIX +#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY) # include # include # include +# define USE_PIPE_EXEC #endif @@ -63,9 +64,9 @@ private: QString getDefaultPrinterFromSystem(); QStringList getPrintersFromSystem(); -#ifdef Q_OS_UNIX +#ifdef USE_PIPE_EXEC QString getOutputFromCommand(const QStringList& command); -#endif // Q_OS_UNIX +#endif // USE_PIPE_EXEC #endif }; @@ -89,7 +90,7 @@ QString tst_QPrinterInfo::getDefaultPrinterFromSystem() #ifdef Q_OS_WIN32 // TODO "cscript c:\windows\system32\prnmngr.vbs -g" #endif // Q_OS_WIN32 -#ifdef Q_OS_UNIX +#ifdef USE_PIPE_EXEC QStringList command; command << "lpstat" << "-d"; QString output = getOutputFromCommand(command); @@ -103,7 +104,7 @@ QString tst_QPrinterInfo::getDefaultPrinterFromSystem() QRegularExpression defaultReg("default.*: *([a-zA-Z0-9_-]+)"); match = defaultReg.match(output); printer = match.captured(1); -#endif // Q_OS_UNIX +#endif // USE_PIPE_EXEC return printer; } @@ -114,7 +115,7 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem() #ifdef Q_OS_WIN32 // TODO "cscript c:\windows\system32\prnmngr.vbs -l" #endif // Q_OS_WIN32 -#ifdef Q_OS_UNIX +#ifdef USE_PIPE_EXEC QString output = getOutputFromCommand({ "lpstat", "-e" }); QStringList list = output.split(QChar::fromLatin1('\n')); @@ -127,12 +128,12 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem() ans << printer; } } -#endif // Q_OS_UNIX +#endif // USE_PIPE_EXEC return ans; } -#ifdef Q_OS_UNIX +#ifdef USE_PIPE_EXEC // This function does roughly the same as the `command substitution` in // the shell. QString getOutputFromCommandInternal(const QStringList &command) -- cgit v1.2.3