More dumb regression questions

Francois Gouget fgouget at free.fr
Sat Mar 23 14:02:28 CST 2002


On 23 Mar 2002, Geoffrey Hausheer wrote:

> How do I run a wine perl regression test in Windows?

   Well, that's part of the unfinished items. Currently you have to:
 * install Perl on Windows
   The best seems to be to get Perl from source and compile it, e.g.
with Visual C++.
 * get the whole Wine tree to Windows
 * tweak programs/winetest/Makefile.win32 to adapt to the directory
where you have perl installed. Typically just replace
   PERLDIR = c:\perl\5.6.0\lib\MSWin32-x86\CORE
   XSUBPPDIR = c:\perl\5.6.0\lib\ExtUtils
   with
   PERLDIR = c:\perl\5.6.1\lib\MSWin32-x86\CORE
   XSUBPPDIR = c:\perl\5.6.1\lib\ExtUtils
 * run tests manually by invoking programs/winetest/runtests with the
right options.


> I thought the entire point was to make it so you don't
> need a c-compiler, yet I can't seem to get the tests to
> run without the winetest application (which I've been
> unable to build on windows so far).  Is it planned that
> this executable be distributed with wine, or am I missing
> something else?

   Is it planned, yes. Is it done? No, not yet :-(

> Ideally, I'd like to be able to get just the tests and
> required apps through cvs (or even a .zip file), and run
> them.  If this is possible today, it isn't obvious (to
> me) how to do it.

   Yes, that's the plan: regularly generate a zip file to put on WineHQ,
so that people can just grab the zip file and run some batch script to
invoke all the tests.

   Perl tests aside, I have started working on a perl script that would
generate Makefiles suitable for running the C tests on Windows using
Visual C++. But it's not finished yet and I had to stop working on it
for a while. I attached it to this email so that someone can pick it up.
Please let me know if you do.


> Sorry if this is documented somewhere, but I checked
> Francois' presentation, and the huge thread in January,
> and didn't find anything about it.

   That's another item: my presentation should be converted and
integrated into the Wine Developper's Guide. That's the right place for
such documentation.


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
 The greatest programming project of all took six days; on the seventh day the
  programmer rested. We've been trying to debug the *&^%$#@ thing ever since.
                      Moral: design before you implement.
-------------- next part --------------
#!/usr/bin/perl -w

#use strict;


sub read_makefile($)
{
    my $filename=$_[0];
    my $module=[];
    my $perl_tests=[];
    my $c_tests=[];
    my $subdirs=[];

    if (open(MAKEFILE,$filename))
    {
        my $current_list;
        my $dirname=$filename;
        if (!($dirname =~ s+/[^/]*$++))
        {
            $dirname=".";
        }

        while (<MAKEFILE>)
        {
            if (s/^\s*MODULE\s*=//)
            {
                $current_list=$module;
            }
            elsif (s/^\s*(INSTALL)?SUBDIRS\s*=\s*//)
            {
                $current_list=$subdirs;
            }
            elsif (s/^\s*PLTESTS\s*=//)
            {
                $current_list=$perl_tests;
            }
            elsif (s/^\s*CTESTS\s*=\s*//)
            {
                $current_list=$c_tests;
            }
            if (defined $current_list)
            {
                my $continue=(s/\\$//?1:0);
                s/^\s*//;
                push @$current_list, split /\s+/;
                undef $current_list if (!$continue);
            }
        }
        close(MAKEFILE);
    }
    return ($module,$perl_tests,$c_tests,$subdirs);
}

sub generate_list($)
{
    my $list=$_[0];

    foreach $item (@$list)
    {
        print MAKEFILE " \\\r\n\t$item";
    }
    print MAKEFILE "\n" if (@$list);
}

sub write_win32_makefile($$$$)
{
    my $filename=$_[0];
    my $module=$_[1];
    my $perl_tests=$_[2];
    my $c_tests=$_[3];

    open(MAKEFILE,">$filename") || die "Could not write to $filename\n";

    print MAKEFILE "TOTOP = ..\\..\r\n";
    # todo
    print MAKEFILE "\r\n";
    print MAKEFILE "MODULE=@$module[0]\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE "PLTESTS = ";
    generate_list($perl_tests);
    print MAKEFILE "\r\n";
    print MAKEFILE "CTESTS = ";
    generate_list($c_tests);
    print MAKEFILE "\r\n";
    print MAKEFILE "LIBRARIES = \r\n";
    # todo
    print MAKEFILE "\r\n";
    print MAKEFILE "CC = cl -nologo -c\r\n";
    print MAKEFILE "CFLAGS = -DWIN32 -D_X86_ -D__i386__\r\n";
    print MAKEFILE "INCLUDE=\$(INCLUDE);\$(TOTOP)\\\$(TOPSRCDIR)\\include\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE "RUNTEST      = \$(TOTOP)\\\$(TOPSRCDIR)\\programs\\winetest\\runtest.bat\r\n";
    print MAKEFILE "RUNTESTFLAGS = -q\r\n";
    print MAKEFILE "TESTRESULTS  = \$(CTESTS:.c=.wok)\r\n";
    print MAKEFILE "TESTPROGRAM  = tests\\\$(MODULE)_test\r\n";
    print MAKEFILE "TESTLIST     = tests\\testlist.c\r\n";
    print MAKEFILE "TESTOBJS     = \$(TESTMAIN) \$(TESTLIST:.c=.obj) \$(CTESTS:.c=.obj)\r\n";
    print MAKEFILE "TESTMAIN     = \$(TOTOP)\\programs\\winetest\\wtmain.obj\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE "ctest: \$(CTESTS:.c=.wok)\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE "\$(CTESTS:.c=.wok): \$(TESTPROGRAM).exe\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE ".c.wok:\r\n";
    print MAKEFILE "	\$(RUNTEST) \$(TESTPROGRAM).exe \$< \$\@ \$(RUNTESTFLAGS)\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE ".c.obj:\r\n";
    print MAKEFILE "	\$(CC) \$(CFLAGS) -Fo\$*.obj \$<\r\n";
    print MAKEFILE "\r\n";
    print MAKEFILE "\$(TESTPROGRAM).exe: \$(TESTOBJS)\r\n";
    print MAKEFILE "	link -nologo -out:\$\@ \$(LDFLAGS) \$(TESTOBJS) \$(LIBRARIES)\r\n";

    close(MAKEFILE);
}

#my ($perl_tests,$c_tests)=read_makefile($ARGV[0]);
#print "perl_tests=@$perl_tests\n";
#print "c_tests=", join(",",@$c_tests),"\n";

sub convert_makefile
{
    my $test_dirs=$_[0];
    my $filename=$_[1];
    my $dirname=$filename;
    $dirname =~ s+/[^/]*$++;

    print "converting $filename (in $dirname)\n";
    my ($module,$perl_tests,$c_tests,$subdirs)=read_makefile($filename);
    if (@$perl_tests || @$c_tests)
    {
        print "$dirname has tests\n";
        push @$test_dirs,$dirname;
        write_win32_makefile("$dirname/win32_tests.mak",$module,$perl_tests,$c_tests);
    }
    foreach $subdir (@$subdirs)
    {
        print "$dirname/$subdir/Makefile.in\n";
        if (-e "$dirname/$subdir/Makefile.in")
        {
            convert_makefile($test_dirs,"$dirname/$subdir/Makefile.in");
        }
    }
}

#
# Main
#
if (-e "./Makefile.in")
{
    my $test_dirs=[];
    convert_makefile($test_dirs,"./Makefile.in");
    #if (@$test_dirs)
}


More information about the wine-devel mailing list