P.O., On 13.08.2021 17:10, P. O. Jonsson wrote: > None of the machines attached to Jenkins have printers defined most of them > are defined in VMs. > Seems to me a strange requirement for the test to have a printer defined? > Could the test not skip > if there is no printer defined? This appears to be a win only problem > W7/8.1/10
you could try to change the test to initialize the variable "wmiDefault" to the blank string, such that "::options novalue error" does not get raised, like this (or take the full version from the attachment): ::method 'testDefaultPrinter' objWMIService = .oleObject~getObject("winmgmts:\\.\root\cimv2") colInstalledPrinters = objWMIService~ExecQuery("Select * from Win32_Printer") /*wmiDefault=""*/ do objPrinter over colInstalledPrinters if objPrinter~default then wmiDefault = objPrinter~Name end parse value SysWinGetDefaultPrinter() with sysDefault','. -- Assert that sys & wmi return the same default printer self~AssertSame(wmiDefault,sysDefault) HTH, ---rony > Am 13.08.2021 um 14:15 schrieb Rony G. Flatscher <rony.flatsc...@wu.ac.at>: >> >> >> >> Here the code section: >> >> Printers.testGroup-86- do objPrinter over colInstalledPrinters >> Printers.testGroup-87- if objPrinter~default then >> Printers.testGroup:88: wmiDefault = objPrinter~Name >> Printers.testGroup-89- end >> Printers.testGroup-90- parse value SysWinGetDefaultPrinter() with >> sysDefault','. >> Printers.testGroup-91--- Assert that sys & wmi return the same default >> printer >> Printers.testGroup:92: self~AssertSame(wmiDefault,sysDefault) >> >> So it seems that on your machine there is no default printer installed such >> that "wmiDefault" >> remains unassigned. >> >> HTH >> >> ---rony >> >> >> On 13.08.2021 13:12, P.O. Jonsson wrote: >>> Ok so there seems to be a variable WMIDEFAULT that is not defined in the >>> Jenkins machines, this >>> is the output (also on r 12286): >>> >>> ooTest Framework - Automated Test of the ooRexx Interpreter >>> >>> Interpreter: REXX-ooRexx_5.0.0(MT)_32-bit 6.05 12 Aug 2021 >>> OS Name: WindowsNT >>> SysVersion: Windows 10.0.19043 >>> >>> Tests ran: 24292 >>> Assertions: 375337 >>> Failures: 0 >>> Errors: 1 >>> >>> [error] 20210813 08:56:55.632000 >>> svn: r11522 Change date: 2018-11-22 01:34:56 +0100 >>> Test: TESTDEFAULTPRINTER >>> Class: Printers.testgroup >>> File: ...\ooRexx\extensions\platform\windows\ole\Printers.testGroup >>> Event: [SYNTAX 98.986] raised unexpectedly. >>> Reference to unassigned variable "WMIDEFAULT". >>> Line: 92 >>> 92 *-* self~AssertSame(wmiDefault,sysDefault) >>> *-* Compiled method "SEND" with scope "Message". >>> 1583 *-* .message~new(self, methodName)~send >>> 1558 *-* self~doTheTest(fName, aTestResult) -- carry out the testmethod >>> 552 *-* test~execute(testResult, verbose) >>> 552 *-* test~execute(testResult, verbose) >>> 110 *-* suite~execute(testResult) >>> 79 *-* retCode = 'worker.rex'(arguments) >>> >>> Interpreter: REXX-ooRexx_5.0.0(MT)_32-bit 6.05 12 Aug 2021 >>> OS Name: WindowsNT >>> SysVersion: Windows 10.0.19043 >>> >>> Tests ran: 24292 >>> Assertions: 375337 >>> Failures: 0 >>> Errors: 1 >>> >>> File search: 00:00:06.637000 >>> Suite construction: 00:00:01.217000 >>> Test execution: 00:07:53.232000 >>> Total time: 00:08:01.087000 >>> >>> >>> jenkins@DELLGX760 >>> C:\Users\Jenkins\workspace\ooRexx-windows32-test\oorexxTest>exit 2 >>> Build step 'Execute Windows batch command' marked build as failure >>> Finished: FAILURE >>> >>> >>> Hälsningar/Regards/Grüsse, >>> P.O. Jonsson >>> oor...@jonases.se <mailto:oor...@jonases.se> >>> >>> >>> >>> >>>> Am 13.08.2021 um 12:20 schrieb Rony G. Flatscher <rony.flatsc...@wu.ac.at >>>> <mailto:rony.flatsc...@wu.ac.at>>: >>>> >>>> On 13.08.2021 12:13, Rony G. Flatscher wrote: >>>>> On 13.08.2021 08:56, P.O. Jonsson wrote: >>>>>> I had a look at Jenkins this morning and Windows 32 and 64 bit test for >>>>>> all W7/8/10 all fail >>>>>> 1 test in the printers.testGroup, the test TestDefaultPrinter. Can >>>>>> someone please have a look? >>>>> >>>>> >>>>> F:\work\svn\oorexx\test\trunk\ooRexx\extensions\platform\windows\ole>dir >>>>> Volume in drive F is root_f >>>>> Volume Serial Number is 7A10-C4A0 >>>>> >>>>> Directory of >>>>> F:\work\svn\oorexx\test\trunk\ooRexx\extensions\platform\windows\ole >>>>> >>>>> 29.03.2021 15:58 <DIR> . >>>>> 29.03.2021 15:58 <DIR> .. >>>>> 04.03.2020 13:18 4 764 ExcelQuickTest.testGroup >>>>> 04.03.2020 13:18 19 410 OLEVariant.testGroup >>>>> 04.03.2020 13:18 4 852 Printers.testGroup >>>>> 04.03.2020 13:18 3 988 RexxProcess.testGroup >>>>> 29.03.2021 15:58 4 451 SpecialFolders.testGroup >>>>> 5 File(s) 37 465 bytes >>>>> 2 Dir(s) 20 256 874 496 bytes free >>>>> >>>>> >>>>> F:\work\svn\oorexx\test\trunk\ooRexx\extensions\platform\windows\ole>rexx >>>>> Printers.testGroup >>>>> Interpreter: REXX-ooRexx_5.0.0(MT)_32-bit 6.05 13 Aug 2021 >>>>> OS Name: WindowsNT >>>>> SysVersion: Windows 10.0.19042 >>>>> >>>>> Tests ran: 4 >>>>> Assertions: 34 >>>>> Failures: 0 >>>>> Errors: 0 >>>>> >>>>> Test execution: 00:00:01.483000 >>>>> >>>>> As you can see I am not able to duplicate, the test runs o.k. >>>>> >>>>> ---rony >>>>> >>>> Forgot to supply the ooRexx version: >>>> >>>> Open Object Rexx Version 5.0.0 r12286 >>>> >>>> ---rony >>>>
#!/usr/bin/env rexx /* SVN Revision: $Rev: 11522 $ Change Date: $Date: 2018-11-22 01:34:56 +0100 (Do., 22 Nov 2018) $ */ /*----------------------------------------------------------------------------*/ /* */ /* Copyright (c) 2007-2018 Rexx Language Association. All rights reserved. */ /* */ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ /* distribution. A copy is also available at the following address: */ /* http://www.oorexx.org/license.html */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ /* conditions are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the distribution. */ /* */ /* Neither the name of Rexx Language Association nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ parse source . . fileSpec; group = .TestGroup~new(fileSpec) group~add(.Printers.testGroup) group~restrictOS("WINDOWS") if group~isAutomatedTest then return group testResult = group~suite~execute~~print return testResult -- End of entry point. ::requires 'ooTest.frm' ::class 'Printers.testgroup' subclass ooTestCase public ::method 'testPrinterNames' objWMIService = .oleObject~getObject("winmgmts:\\.\root\cimv2") colInstalledPrinters = objWMIService~ExecQuery("Select * from Win32_Printer") wmiPrinters = .array~new do objPrinter over colInstalledPrinters wmiPrinters~append(objPrinter~name) end sysPrinters = .array~new rv = SysWinGetPrinters(all_printers.) -- Assert that all sysPrinters are in wmiPrinters do i = 1 to all_printers.0 parse var all_printers.i pname','. sysPrinters~append(pname) self~assertTrue(wmiPrinters~hasItem(pname)) end -- Assert that both arrays have the same number of items self~assertTrue(sysPrinters~items == wmiPrinters~items) -- Assert that all wmiPrinters are in sysPrinters do i = 1 to wmiPrinters~items self~assertTrue(sysPrinters~hasItem(wmiPrinters[i])) end ::method 'testDefaultPrinter' objWMIService = .oleObject~getObject("winmgmts:\\.\root\cimv2") colInstalledPrinters = objWMIService~ExecQuery("Select * from Win32_Printer") wmiDefault="" do objPrinter over colInstalledPrinters if objPrinter~default then wmiDefault = objPrinter~Name end parse value SysWinGetDefaultPrinter() with sysDefault','. -- Assert that sys & wmi return the same default printer self~AssertSame(wmiDefault,sysDefault) ::options novalue error
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel