3 print "\nGenerating automated scripts for NetWare...\n\n\n";
9 chdir '/perl/scripts/';
12 # These scripts have problems (either abend or hang) as of now (11 May 2001).
13 # So, they are commented out in the corresponding auto scripts, io.pl and lib.pl
14 @ScriptsNotUsed = ("t/io/openpid.t", "t/lib/filehandle.t", "t/lib/memoize/t/expire_module_t.t", "t/lib/NEXT/t/next.t", "t/lib/Math/BigInt/t/require.t", "t/ext/B/t/debug.t", "t/lib/IPC/Open3.t", "t/ext/B/t/showlex.t", "t/op/subst_wamp.t", "t/uni/upper.t", "t/lib/Net/t/ftp.t", "t/op/sort.t", "t/ext/POSIX/t/posix.t", "t/lib/CPAN/t/loadme.t", "t/lib/CPAN/t/vcmp.t");
16 opendir(DIR, $DirName);
19 foreach $DirItem(@Dirs)
21 $DirItem1 = $DirName."/".$DirItem;
22 push @DirNames, $DirItem1; # All items under $DirName folder is copied into an array.
25 { # If an item is a folder, then open it further.
27 # Intemediary automated script like base.pl, lib.pl, cmd.pl etc.
28 $IntAutoScript = "t/".$DirItem.".pl";
30 # Open once in write mode since later files are opened in append mode,
31 # and if there already exists a file with the same name, all further opens
32 # will append to that file!!
33 open(FHW, "> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for writing.\n";
34 seek(FHW, 0, 0); # seek to the beginning of the file.
35 close FHW; # close the file.
40 print "Generating t/nwauto.pl ...\n\n\n";
42 open(FHWA, "> t/nwauto.pl") or die "Unable to open the file, t/nwauto.pl for writing.\n";
43 seek(FHWA, 0, 0); # seek to the beginning of the file.
45 $version = sprintf("%vd",$^V);
46 print FHWA "\n\nprint \"Automated Unit Testing of Perl$version for NetWare\\n\\n\\n\"\;\n\n\n";
49 foreach $FileName(@DirNames)
53 { # If an item is a folder, then open it further.
55 $dir = dirname($FileName); # Get the folder name
57 foreach $DirItem1(@Dirs)
59 $DirItem2 = $DirItem1;
60 if($FileName =~ m/$DirItem2/)
64 # Intemediary automated script like base.pl, lib.pl, cmd.pl etc.
65 $IntAutoScript = "t/".$DirItem.".pl";
69 # Write into the intermediary auto script.
70 open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
71 seek(FHW, 0, 2); # seek to the end of the file.
76 print "Generating $IntAutoScript...\n";
77 print FHW "\n\nprint \"Testing $DirItem folder:\\n\\n\\n\"\;\n\n\n";
80 opendir(SUBDIR, $FileName);
81 @SubDirs = readdir(SUBDIR);
83 foreach $SubFileName(@SubDirs)
85 $SubFileName = $FileName."/".$SubFileName;
88 push @DirNames, $SubFileName; # If sub-folder, push it into the array.
92 &Process_File($SubFileName); # If file, process it.
98 close FHW; # close the file.
102 # The folder is empty and delete the corresponding '.pl' file.
103 unlink($IntAutoScript);
104 print "Deleted $IntAutoScript since it corresponded to an empty folder.\n";
109 { # This logic to make sure that it is written only once.
110 # Only if something is written into the intermediary auto script,
111 # only then make an entry of the intermediary auto script in nwauto.pl
112 print FHWA "print \`perl $IntAutoScript\`\;\n";
113 print FHWA "print \"\\n\\n\\n\"\;\n\n";
121 $dir = dirname($FileName); # Get the folder name
122 $base = basename($FileName); # Get the base name
123 ($base, $dir, $ext) = fileparse($FileName, '\..*'); # Get the extension of the file passed.
125 # Do the processing only if the file has '.t' extension.
128 print FHWA "print \`perl $FileName\`\;\n";
129 print FHWA "print \"\\n\\n\\n\"\;\n\n";
136 ## Below adds the ending comments into all the intermediary auto scripts:
138 opendir(DIR, $DirName);
139 @Dirs = readdir(DIR);
141 foreach $DirItem(@Dirs)
145 $FileName = $DirName."/".$DirItem;
147 { # If an item is a folder, then open it further.
149 opendir(SUBDIR, $FileName);
150 @SubDirs = readdir(SUBDIR);
153 # To not to write into the file if the corresponding folder was empty.
154 foreach $SubDir(@SubDirs)
161 # The folder not empty.
163 # Intemediary automated script like base.pl, lib.pl, cmd.pl etc.
164 $IntAutoScript = "t/".$DirItem.".pl";
166 # Write into the intermediary auto script.
167 open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
168 seek(FHW, 0, 2); # seek to the end of the file.
170 # Write into the intermediary auto script.
171 print FHW "\nprint \"Testing of $DirItem folder done!\\n\\n\"\;\n\n";
173 close FHW; # close the file.
179 # Write into nwauto.pl
180 print FHWA "\nprint \"Automated Unit Testing of Perl$version for NetWare done!\\n\\n\"\;\n\n";
182 close FHWA; # close the file.
184 print "\n\nGeneration of t/nwauto.pl Done!\n\n";
186 print "\nGeneration of automated scripts for NetWare DONE!\n";
194 local($FileToProcess) = @_; # File name.
199 ## If the value of $FileToProcess is '/perl/scripts/t/pragma/warnings.t', then
200 ## $dir1 = '/perl/scripts/t/pragma/'
201 ## $base1 = 'warnings'
203 $dir1 = dirname($FileToProcess); # Get the folder name
204 $base1 = basename($FileToProcess); # Get the base name
205 ($base1, $dir1, $ext1) = fileparse($FileToProcess, '\..*'); # Get the extension of the file passed.
207 # Do the processing only if the file has '.t' extension.
210 foreach $Script(@ScriptsNotUsed)
212 # The variables are converted to lower case before they are compared.
213 # This is done to remove the case-sensitive comparison done by 'eq'.
214 $Script1 = lc($Script);
215 $FileToProcess1 = lc($FileToProcess);
216 if($Script1 eq $FileToProcess1)
224 # Write into the intermediary auto script.
228 # Write into the intermediary auto script.
229 print FHW "print \"Testing $base1"."$ext1:\\n\\n\"\;\n";
230 print FHW "print \`perl $FileToProcess\`\;\n"; # Write the changed array into the file.
231 print FHW "print \"\\n\\n\\n\"\;\n";
235 # Write into the intermediary auto script.