cygwin and tests

Help
M West
2008-09-30
2013-04-25
  • M West
    M West
    2008-09-30

    I would like to install W::GT on cygwin.  I find 1.54 in the cpan shell hangs after reporting a failed test in t/02_calc .  Doing 1.55 by hand, it fails with nmake, apparently due to path names, and fails with make, also perhaps due to filenames.

    Can anyone offer advice about installing on cygwin?

      KARASIK/Win32-GuiTest-1.54.tar.gz
      /usr/bin/make -- OK
    Running make test
    /usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'b
    lib/arch')" t/*.t
    t/01_basic.............ok
    t/02_calc..............
    #   Failed test '1969 in hex found'
    #   at t/02_calc.t line 88.
    #          got: '1969. '
    #     expected: '7B1 '
    # Looks like you failed 1 test of 24.

    ...

    westmwj@5SQF5D1 ~/MyDocuments/downloads
    $ tar -xzf Win32-GuiTest-1_55.tar.gz

    westmwj@5SQF5D1 ~/MyDocuments/downloads
    $ cd Win32-GuiTest
    Win32-GuiTest/             Win32-GuiTest-1_55.tar.gz
    Win32-GuiTest-1.54.readme

    westmwj@5SQF5D1 ~/MyDocuments/downloads
    $ cd Win32-GuiTest

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest
    $ perl Makefile.PL
    Checking if your kit is complete...
    Looks good
    Writing Makefile for Win32::GuiTest

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest
    $ nmake

    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (c) Microsoft Corp 1988-94. All rights reserved.

    NMAKE : fatal error U1073: don't know how to make '/usr/lib/perl5/5.8/cygwin/Con
    fig.pm'
    Stop.

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest
    $ make
    Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::Fas
    tCalc at /usr/lib/perl5/vendor_perl/5.8/cygwin/Win32API/File.pm line 20
    cp lib/win32/GuiTest/Cmd.pm blib/lib/win32/GuiTest/Cmd.pm
    cp makedist.pl blib/lib/Win32/makedist.pl
    cp lib/win32/GuiTest/Examples.pm blib/lib/win32/GuiTest/Examples.pm
    cp lib/win32/GuiTest/GuiTest.pc blib/lib/win32/GuiTest/GuiTest.pc
    cp make_eg.pl blib/lib/Win32/make_eg.pl
    cp lib/win32/GuiTest.pm blib/lib/win32/GuiTest.pm
    Package Win32::GuiTest::Window (Win32/GuiTest/Window.pm) does not match filename
    blib/lib/win32/GuiTest.pm at /usr/lib/perl5/5.8/AutoSplit.pm line 263, <$in> li
    ne 1728.
    make: *** [pm_to_blib] Error 255

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest
    $

    $ perl -V
    Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
      Platform:
        osname=cygwin, osvers=1.5.24(0.15642), archname=cygwin-thread-multi-64int
        uname='cygwin_nt-5.1 reini 1.5.24(0.15642) 2007-01-31 10:57 i686 cygwin '
        config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads -Uusemymalloc -Dopt
    imize=-O3 -Dman3ext=3pm -Dusesitecustomize -Dusedevel'
        hint=recommended, useposix=true, d_sigaction=define
        usethreads=define use5005threads=undef useithreads=define usemultiplicity=de
    fine
        useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
        use64bitint=define use64bitall=undef uselongdouble=undef
        usemymalloc=n, bincompat5005=undef
      Compiler:
        cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdecl
    aration-after-statement',
        optimize='-O3',
        cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdeclaration-af
    ter-statement'
        ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
    ', gccosandvers=''
        intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
        d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
        ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lsee
    ksize=8
        alignbytes=8, prototype=define
      Linker and Libraries:
        ld='ld2', ldflags =' -s -L/usr/local/lib'
        libpth=/usr/local/lib /usr/lib /lib
        libs=-lgdbm -ldb -ldl -lcrypt -lgdbm_compat
        perllibs=-ldl -lcrypt -lgdbm_compat
        libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
        gnulibc_version=''
      Dynamic Linking:
        dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
        cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'

    Characteristics of this binary (from libperl):
      Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                            PERL_MALLOC_WRAP PERL_USE_SAFE_PUTENV
                            USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                            USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE
      Locally applied patches:
            CYG01 - hints.cygwin.sh ldflags -s
            CYG02 - lib-ExtUtils-Embed insensitive against leading \s
            CYG03 - lib-Test-Harness-Straps $ENV{PERL5LIB} = ''
            CYG04 - major.version.cygwin.sh cygperl-5_8.dll and not cygperl-5_8_x.dl
    l
            CYG05 - add Win32CORE to core
            CYG07 - File-Spec-Cygwin-TMPDIR.patch
            Bug#38628 - allow legacy Cwd->cwd()
            Bug#40103 - File-Spec-case_tolerant.patch from 5.9.5
      Built under cygwin
      Compiled at Jul  8 2007 19:12:08
      %ENV:
        CYGWIN="server"
      @INC:
        /usr/lib/perl5/5.8/cygwin
        /usr/lib/perl5/5.8
        /usr/lib/perl5/site_perl/5.8/cygwin
        /usr/lib/perl5/site_perl/5.8
        /usr/lib/perl5/site_perl/5.8
        /usr/lib/perl5/vendor_perl/5.8/cygwin
        /usr/lib/perl5/vendor_perl/5.8
        /usr/lib/perl5/vendor_perl/5.8
        .

    westmwj@5SQF5D1 ~/MyDocuments/downloads/Win32-GuiTest
    $

     
    • Dmitry Karasik
      Dmitry Karasik
      2008-10-01

      Two things: 1.54 works under cygwin fine, I didn't check why that calculator test fails, but I think that's a minor issue. The module itself works (at least undef my cygwin).

      About 1.55, that was forked off 1.54 that I am responsible for, it comes with bugs, including yours complains about the wrong package. I noticed them before, fixed already, 1.56 candidate is already in cvs on sourceforge, in a couple of days it'll be released on CPAN.

      Last advice: don't use nmake with cygwin, it won't work anyway.

       
      • M West
        M West
        2008-10-02

        I downloaded and tested 1.56, and now understand the calc test failure about hex.  The reason it fails test 14 of 02_calc.t is that I use a Logitech marble mouse with my left hand, and have reversed my right click and left click.  When I use the original test, instead of the

                SendLButtonDown();
                SendLButtonUp();

        filling the radio button, I get a "What's This?" text window.  When I change L to R, it succeeds.

        I do not know the solution in terms of tests, but I am happy to test your revised 02_calc.t.

        $ prove -lbv t/02_calc.t
        t/02_calc......
        ok 1
        ok 2 - found editor
        ok 3 - Editor is a window
        ok 4 - 1969 found
        ok 5 - hex found
        ok 6 - Hex is a window
        ok 7 - Hex is not checked
        ok 8
        ok 9 - Bin is not checked
        ok 10 - Oct window found
        ok 11 - Oct is not checked
        ok 12
        ok 13 - Dec is checked
        not ok 14 - 1969 in hex found

        #   Failed test '1969 in hex found'
        #   at t/02_calc.t line 91.
        #          got: '1969. '
        #     expected: '7B1 '
        ok 15 - 1969 in dec found
        ok 16
        ok 17 - 1969 in hex found
        ok 18
        ok 19 - 1969 in oct found
        ok 20
        ok 21 - 1969 in bin found
        ok 22
        ok 23
        ok 24 - Is window closed ?
        1..24
        # Looks like you failed 1 test of 24.
        Dubious, test returned 1 (wstat 256, 0x100)
        Failed 1/24 subtests

        Test Summary Report
        -------------------
        t/02_calc.t (Wstat: 256 Tests: 24 Failed: 1)
          Failed test:  14
          Non-zero exit status: 1
        Files=1, Tests=24, 11 wallclock secs ( 0.01 usr  0.02 sys +  0.40 cusr  0.15 csy
        s =  0.59 CPU)
        Result: FAIL

        westmwj@5SQF5D1 ~/Win32-GuiTest-1.56
        $ cat t/02_calc.t
        #!perl -w
        BEGIN {
                print "1..0 # Skip win32 required\n" and exit unless $^O =~ /win32|cygwi
        n/i;
                $| = 1;
        }

        # Do some tricks with the calculator
        # $Id: 02_calc.t,v 1.2 2008/10/01 11:10:12 int32 Exp $

        use strict;
        use Test::More qw(no_plan);

        use Win32::GuiTest qw(:ALL);

        my $desk = GetDesktopWindow();

        # It seems that if the calculator opens as Standard then even if we
        # select Scientific mode we cannot find the Hex button.
        # If the calculater already opens as Scientific then things work OK.
        # Moreover (at least on XP) the calculator always opens in the same mode
        # as it was when you closed it so first we open the calculator, make sure
        # to select Scientific mode, close it and then open it again hoping that
        # it is now really in scientific mode.
        {
                system("cmd /c start calc");
                my ($calc) = WaitWindowLike($desk, undef, "^SciCalc\$");
                # hmm, It seems the SciCalc is the name of the class for both the Standa
        rd and the
                # Scientific version of the calculator

                ok(IsWindow($calc));
                SetForegroundWindow($calc);

                MenuSelect("&View|&Scientific");
                SendKeys("%{F4}");
        }

        system("cmd /c start calc");
        my ($calc) = WaitWindowLike($desk, undef, "^SciCalc\$");

        SendKeys("1969");
        my $edit;
        SKIP: {
                ($edit) = FindWindowLike($calc, undef, "Edit|Static");
                ok(defined $edit, "found editor") or skip "could not find Edit window",
        1;
                ok(IsWindow($edit), "Editor is a window");
                is(WMGetText($edit), "1969. ", "1969 found");
        }

        #Find the Hex radio button
        my $hex;
        SKIP: {
                ($hex) = FindWindowLike($calc, "Hex");
                ok(defined $hex, "hex found") or skip "could not find Hex", 2;
                ok(IsWindow($hex), "Hex is a window");
                ok(!IsCheckedButton($hex), "Hex is not checked");
        }

        #Find the Bin, Oct and Dec radio buttons
        my $bin;
        SKIP: {
                ($bin) = FindWindowLike($calc, "Bin");
                ok(IsWindow($bin)) or skip "could not find Bin", 1;
                ok(!IsCheckedButton($bin), "Bin is not checked");
        }

        my $oct;
        SKIP: {
                ($oct) = FindWindowLike($calc, "Oct");
                ok(IsWindow($oct), "Oct window found") or skip "could not find Oct", 1;
                ok(!IsCheckedButton($oct), "Oct is not checked");
        }
        my $dec;
        SKIP: {
                ($dec) = FindWindowLike($calc, "Dec");
                ok(IsWindow($dec)) or skip "could not find Dec", 1;
                ok(IsCheckedButton($dec), "Dec is checked");
        }

        # Click on the Hex radio button
        SKIP: {
                skip "No Hex button, no tests", 1 if not defined $hex;

                my ($wx, $wy) = GetWindowRect($hex);
                my ($cx, $cy) = GetCursorPos();
                MouseMoveAbsPix($wx+1,$wy+1);
                sleep 1;
                SendLButtonDown();
                SendLButtonUp();
                sleep 3;
                MouseMoveAbsPix($cx,$cy);
                is(WMGetText($edit), "7B1 ", "1969 in hex found");
        }

        # try out pushing on window by caption
        SKIP: {
                skip "No Dec/bin/Oct/Hex button(s)", 9 if not ($dec and $bin and $oct an
        d $hex);
                PushButton("Dec"); sleep 1;
                is(WMGetText($edit), "1969. ", "1969 in dec found");
                ok(IsCheckedButton($dec));

                PushButton("Hex"); sleep 2;
                is(WMGetText($edit), "7B1 ", "1969 in hex found");
                ok(IsCheckedButton($hex));

                PushButton("Oct"); sleep 1;
                is(WMGetText($edit), "3661 ", "1969 in oct found");
                ok(IsCheckedButton($oct));

                PushButton("Bin"); sleep 1;
                is(WMGetText($edit), "11110110001 ", "1969 in bin found");
                ok(IsCheckedButton($bin));
                ok(!IsCheckedButton($dec));
        }

        # Close calc
        SendKeys("%{F4}");

        ok(1, "Is window closed ?");

        westmwj@5SQF5D1 ~/Win32-GuiTest-1.56
        $ prove -lbv t/02_calc.t
        t/02_calc......
        ok 1
        ok 2 - found editor
        ok 3 - Editor is a window
        ok 4 - 1969 found
        ok 5 - hex found
        ok 6 - Hex is a window
        ok 7 - Hex is not checked
        ok 8
        ok 9 - Bin is not checked
        ok 10 - Oct window found
        ok 11 - Oct is not checked
        ok 12
        ok 13 - Dec is checked
        ok 14 - 1969 in hex found
        ok 15 - 1969 in dec found
        ok 16
        ok 17 - 1969 in hex found
        ok 18
        ok 19 - 1969 in oct found
        ok 20
        ok 21 - 1969 in bin found
        ok 22
        ok 23
        ok 24 - Is window closed ?
        1..24
        ok
        All tests successful.
        Files=1, Tests=24, 11 wallclock secs ( 0.03 usr  0.00 sys +  0.39 cusr  0.14 csy
        s =  0.56 CPU)
        Result: PASS

        westmwj@5SQF5D1 ~/Win32-GuiTest-1.56
        $ cat t/02_calc.t
        #!perl -w
        BEGIN {
                print "1..0 # Skip win32 required\n" and exit unless $^O =~ /win32|cygwi
        n/i;
                $| = 1;
        }

        # Do some tricks with the calculator
        # $Id: 02_calc.t,v 1.2 2008/10/01 11:10:12 int32 Exp $

        use strict;
        use Test::More qw(no_plan);

        use Win32::GuiTest qw(:ALL);

        my $desk = GetDesktopWindow();

        # It seems that if the calculator opens as Standard then even if we
        # select Scientific mode we cannot find the Hex button.
        # If the calculater already opens as Scientific then things work OK.
        # Moreover (at least on XP) the calculator always opens in the same mode
        # as it was when you closed it so first we open the calculator, make sure
        # to select Scientific mode, close it and then open it again hoping that
        # it is now really in scientific mode.
        {
                system("cmd /c start calc");
                my ($calc) = WaitWindowLike($desk, undef, "^SciCalc\$");
                # hmm, It seems the SciCalc is the name of the class for both the Standa
        rd and the
                # Scientific version of the calculator

                ok(IsWindow($calc));
                SetForegroundWindow($calc);

                MenuSelect("&View|&Scientific");
                SendKeys("%{F4}");
        }

        system("cmd /c start calc");
        my ($calc) = WaitWindowLike($desk, undef, "^SciCalc\$");

        SendKeys("1969");
        my $edit;
        SKIP: {
                ($edit) = FindWindowLike($calc, undef, "Edit|Static");
                ok(defined $edit, "found editor") or skip "could not find Edit window",
        1;
                ok(IsWindow($edit), "Editor is a window");
                is(WMGetText($edit), "1969. ", "1969 found");
        }

        #Find the Hex radio button
        my $hex;
        SKIP: {
                ($hex) = FindWindowLike($calc, "Hex");
                ok(defined $hex, "hex found") or skip "could not find Hex", 2;
                ok(IsWindow($hex), "Hex is a window");
                ok(!IsCheckedButton($hex), "Hex is not checked");
        }

        #Find the Bin, Oct and Dec radio buttons
        my $bin;
        SKIP: {
                ($bin) = FindWindowLike($calc, "Bin");
                ok(IsWindow($bin)) or skip "could not find Bin", 1;
                ok(!IsCheckedButton($bin), "Bin is not checked");
        }

        my $oct;
        SKIP: {
                ($oct) = FindWindowLike($calc, "Oct");
                ok(IsWindow($oct), "Oct window found") or skip "could not find Oct", 1;
                ok(!IsCheckedButton($oct), "Oct is not checked");
        }
        my $dec;
        SKIP: {
                ($dec) = FindWindowLike($calc, "Dec");
                ok(IsWindow($dec)) or skip "could not find Dec", 1;
                ok(IsCheckedButton($dec), "Dec is checked");
        }

        # Click on the Hex radio button
        SKIP: {
                skip "No Hex button, no tests", 1 if not defined $hex;

                my ($wx, $wy) = GetWindowRect($hex);
                my ($cx, $cy) = GetCursorPos();
                MouseMoveAbsPix($wx+1,$wy+1);
                sleep 1;
                SendRButtonDown();
                SendRButtonUp();
                sleep 3;
                MouseMoveAbsPix($cx,$cy);
                is(WMGetText($edit), "7B1 ", "1969 in hex found");
        }

        # try out pushing on window by caption
        SKIP: {
                skip "No Dec/bin/Oct/Hex button(s)", 9 if not ($dec and $bin and $oct an
        d $hex);
                PushButton("Dec"); sleep 1;
                is(WMGetText($edit), "1969. ", "1969 in dec found");
                ok(IsCheckedButton($dec));

                PushButton("Hex"); sleep 2;
                is(WMGetText($edit), "7B1 ", "1969 in hex found");
                ok(IsCheckedButton($hex));

                PushButton("Oct"); sleep 1;
                is(WMGetText($edit), "3661 ", "1969 in oct found");
                ok(IsCheckedButton($oct));

                PushButton("Bin"); sleep 1;
                is(WMGetText($edit), "11110110001 ", "1969 in bin found");
                ok(IsCheckedButton($bin));
                ok(!IsCheckedButton($dec));
        }

        # Close calc
        SendKeys("%{F4}");

        ok(1, "Is window closed ?");

         
    • M West
      M West
      2008-10-01

      Thanks.  I will wait for the cpan release, as I do not know how to get CVS to work through this firewall.

      I appreciate your work.

      Regards,

      Mike