Skip to content

Commit

Permalink
adding the smoketest scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bsharma%netscape.com committed Jun 7, 1999
1 parent b9b65d6 commit f471356
Show file tree
Hide file tree
Showing 19 changed files with 12,965 additions and 0 deletions.
148 changes: 148 additions & 0 deletions tools/tests/win32/Copy.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# File/Copy.pm. Written in 1994 by Aaron Sherman <ajs@ajs.com>. This
# source code has been placed in the public domain by the author.
# Please be kind and preserve the documentation.
#

package File::Copy;

require Exporter;
use Carp;

@ISA=qw(Exporter);
@EXPORT=qw(copy);
@EXPORT_OK=qw(copy cp);

$File::Copy::VERSION = '1.5';
$File::Copy::Too_Big = 1024 * 1024 * 2;

sub VERSION {
# Version of File::Copy
return $File::Copy::VERSION;
}

sub copy {
croak("Usage: copy( file1, file2 [, buffersize]) ")
unless(@_ == 2 || @_ == 3);

my $from = shift;
my $to = shift;
my $recsep = $\;
my $closefrom=0;
my $closeto=0;
my ($size, $status, $r, $buf);
local(*FROM, *TO);

$\ = '';

if (ref(\$from) eq 'GLOB') {
*FROM = $from;
} elsif (defined ref $from and
(ref($from) eq 'GLOB' || ref($from) eq 'FileHandle')) {
*FROM = *$from;
} else {
open(FROM,"<$from")||goto(fail_open1);
$closefrom = 1;
}

if (ref(\$to) eq 'GLOB') {
*TO = $to;
} elsif (defined ref $to and
(ref($to) eq 'GLOB' || ref($to) eq 'FileHandle')) {
*TO = *$to;
} else {
open(TO,">$to")||goto(fail_open2);
$closeto=1;
}

if (@_) {
$size = shift(@_) + 0;
croak("Bad buffer size for copy: $size\n") unless ($size > 0);
} else {
$size = -s FROM;
$size = 1024 if ($size < 512);
$size = $File::Copy::Too_Big if ($size > $File::Copy::Too_Big);
}

$buf = '';
while(defined($r = read(FROM,$buf,$size)) && $r > 0) {
if (syswrite (TO,$buf,$r) != $r) {
goto fail_inner;
}
}
goto fail_inner unless(defined($r));
close(TO) || goto fail_open2 if $closeto;
close(FROM) || goto fail_open1 if $closefrom;
$\ = $recsep;
return 1;

# All of these contortions try to preserve error messages...
fail_inner:
if ($closeto) {
$status = $!;
$! = 0;
close TO;
$! = $status unless $!;
}
fail_open2:
if ($closefrom) {
$status = $!;
$! = 0;
close FROM;
$! = $status unless $!;
}
fail_open1:
$\ = $recsep;
return 0;
}
*cp = \&copy;

1;

__END__
=head1 NAME
File::Copy - Copy files or filehandles
=head1 USAGE
use File::Copy;
copy("file1","file2");
copy("Copy.pm",\*STDOUT);'
use POSIX;
use File::Copy cp;
$n=FileHandle->new("/dev/null","r");
cp($n,"x");'
=head1 DESCRIPTION
The Copy module provides one function (copy) which takes two
parameters: a file to copy from and a file to copy to. Either
argument may be a string, a FileHandle reference or a FileHandle
glob. Obviously, if the first argument is a filehandle of some
sort, it will be read from, and if it is a file I<name> it will
be opened for reading. Likewise, the second argument will be
written to (and created if need be).
An optional third parameter can be used to specify the buffer
size used for copying. This is the number of bytes from the
first file, that wil be held in memory at any given time, before
being written to the second file. The default buffer size depends
upon the file, but will generally be the whole file (up to 2Mb), or
1k for filehandles that do not reference files (eg. sockets).
You may use the syntax C<use File::Copy "cp"> to get at the
"cp" alias for this function. The syntax is I<exactly> the same.
=head1 RETURN
Returns 1 on success, 0 on failure. $! will be set if an error was
encountered.
=head1 AUTHOR
File::Copy was written by Aaron Sherman <ajs@ajs.com> in 1995.
=cut
77 changes: 77 additions & 0 deletions tools/tests/win32/Intlurl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/perl/bin/perl

@ARGV;
$BaseDir = $ARGV[0];

#############################################

open (REPORT_FILE, '>>report.html');

print (REPORT_FILE "<HR>\n");
print (REPORT_FILE "<B><CENTER><font size=+2>\n");
print (REPORT_FILE "Loading International Sites Results");
print (REPORT_FILE "</font></CENTER></B>\n");

open (URL_FILE, '<Intlurl.txt');

$i = 0;
while (<URL_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
$url_list[$i] = $ThisLine;
$i += 1;
}
for ($i = 0; $i < 13; $i ++)
{
$count = 0;
open (STDOUT, ">log.txt");
select STDOUT; $| =1;

$temp = $BaseDir;
$temp =~ s/\\/\\\\/g;
use Win32::Process;
use Win32;
$cmdLine = "apprunner $url_list[$i]";
Win32::Process::Create($ProcessObj,
# "c:\\program files\\netscape\\seamonkey\\x86rel\\apprunner.exe",
"$temp.\\apprunner.exe",
$cmdLine,
1,
NORMAL_PRIORITY_CLASS,
# "c:\\program files\\netscape\\seamonkey\\x86rel\\");
"$temp");

sleep (60);
$ProcessObj->GetExitCode( $ExitCode );
$ProcessObj->Kill( $ExitCode );
close (STDOUT);

open (APP_LOG_FILE, '< log.txt');
while (<APP_LOG_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
if (/loaded successfully/)
{
$count = $count + 1;
}
}
if ($count >= 1)
{
print (REPORT_FILE "<B>\n");
print (REPORT_FILE "@url_list[$i] Loaded Successfully");
print (REPORT_FILE "</B>\n");
print (REPORT_FILE "<BR>\n");
$count = 0;
}
else
{
print (REPORT_FILE "<B><FONT COLOR='#FF0000'>\n");
print (REPORT_FILE "$url_list[$i] NOT Loaded Successfully");
print (REPORT_FILE "</FONT></B>\n");
print (REPORT_FILE "<BR>\n");
}
close (APP_LOG_FILE);
}
close (REPORT_FILE);
13 changes: 13 additions & 0 deletions tools/tests/win32/Intlurl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
http://www.yahoo.co.jp/index.html
http://www.zdnet.co.jp/pcweek/
http://www.zdnet.co.jp/
http://www.tvspielfilm.de
http://www.focus.de
http://www.joongang.co.kr/
http://www.dongailbo.co.kr/
http://www.chinatimes.com.tw/
http://168.160.224.76/real/game/index.htm
http://www.ntt.co.jp/index-j.html
http://people.netscape.com/erik/sev-nsi-java.html
http://www.unicode.org/unicode/iuc10/x-utf8.html
http://www.unicode.org/unicode/iuc10/x-ncr.html
145 changes: 145 additions & 0 deletions tools/tests/win32/Process.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
package Win32::Process;

require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);

$VERSION = '0.04';

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw(
CREATE_DEFAULT_ERROR_MODE
CREATE_NEW_CONSOLE
CREATE_NEW_PROCESS_GROUP
CREATE_NO_WINDOW
CREATE_SEPARATE_WOW_VDM
CREATE_SUSPENDED
CREATE_UNICODE_ENVIRONMENT
DEBUG_ONLY_THIS_PROCESS
DEBUG_PROCESS
DETACHED_PROCESS
HIGH_PRIORITY_CLASS
IDLE_PRIORITY_CLASS
INFINITE
NORMAL_PRIORITY_CLASS
REALTIME_PRIORITY_CLASS
THREAD_PRIORITY_ABOVE_NORMAL
THREAD_PRIORITY_BELOW_NORMAL
THREAD_PRIORITY_ERROR_RETURN
THREAD_PRIORITY_HIGHEST
THREAD_PRIORITY_IDLE
THREAD_PRIORITY_LOWEST
THREAD_PRIORITY_NORMAL
THREAD_PRIORITY_TIME_CRITICAL
);

sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function.
my($constname);
($constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname);
if ($! != 0) {
my ($pack,$file,$line) = caller;
die "Your vendor has not defined Win32::Process macro $constname, used at $file line $line.";
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
} # end AUTOLOAD

bootstrap Win32::Process;

1;
__END__
=head1 NAME
Win32::Process - Create and manipulate processes.
=head1 SYNOPSIS
use Win32::Process;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32::Process::Create($ProcessObj,
"D:\\winnt35\\system32\\notepad.exe",
"notepad temp.txt",
0,
NORMAL_PRIORITY_CLASS,
".")|| die ErrorReport();
$ProcessObj->Suspend();
$ProcessObj->Resume();
$ProcessObj->Wait(INFINITE);
=head1 DESCRIPTION
This module allows for control of processes in Perl.
=head1 METHODS
=over 8
=item Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)
Creates a new process.
Args:
$obj container for process object
$appname full path name of executable module
$cmdline command line args
$iflags flag: inherit calling processes handles or not
$cflags flags for creation (see exported vars below)
$curdir working dir of new process
=item $ProcessObj->Suspend()
Suspend the process associated with the $ProcessObj.
=item $ProcessObj->Resume()
Resume a suspended process.
=item $ProcessObj->Kill( $ExitCode )
Kill the associated process, have it die with exit code $ExitCode.
=item $ProcessObj->GetPriorityClass($class)
Get the priority class of the process.
=item $ProcessObj->SetPriorityClass( $class )
Set the priority class of the process (see exported values below for
options).
=item $ProcessObj->GetProcessAffinitymask( $processAffinityMask, $systemAffinitymask)
Get the process affinity mask. This is a bitvector in which each bit
represents the processors that a process is allowed to run on.
=item $ProcessObj->SetProcessAffinitymask( $processAffinityMask )
Set the process affinity mask. Only available on Windows NT.
=item $ProcessObj->GetExitCode( $ExitCode )
Retrieve the exitcode of the process.
=item $ProcessObj->Wait($Timeout)
Wait for the process to die. forever = INFINITE
=back
=cut
# Local Variables:
# tmtrack-file-task: "Win32::Process"
# End:
Loading

0 comments on commit f471356

Please sign in to comment.