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/argv.t", "t/io/openpid.t", "t/lib/filehandle.t", "t/lib/warnings.t");
\r
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.
44 flock(FHWA, LOCK_EX); # Lock the file for safety purposes.
46 $version = sprintf("%vd",$^V);
47 print FHWA "\n\nprint \"Automated Unit Testing of Perl$version for NetWare\\n\\n\\n\"\;\n\n\n";
50 foreach $FileName(@DirNames)
54 { # If an item is a folder, then open it further.
56 $dir = dirname($FileName); # Get the folder name
58 foreach $DirItem1(@Dirs)
60 $DirItem2 = $DirItem1;
61 if($FileName =~ m/$DirItem2/)
65 # Intemediary automated script like base.pl, lib.pl, cmd.pl etc.
66 $IntAutoScript = "t/".$DirItem.".pl";
70 # Write into the intermediary auto script.
71 open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
72 seek(FHW, 0, 2); # seek to the end of the file.
73 flock(FHW, LOCK_EX); # Lock the file for safety purposes.
78 print "Generating $IntAutoScript...\n";
79 print FHW "\n\nprint \"Testing $DirItem folder:\\n\\n\\n\"\;\n\n\n";
82 opendir(SUBDIR, $FileName);
83 @SubDirs = readdir(SUBDIR);
85 foreach $SubFileName(@SubDirs)
87 $SubFileName = $FileName."/".$SubFileName;
90 push @DirNames, $SubFileName; # If sub-folder, push it into the array.
94 &Process_File($SubFileName); # If file, process it.
100 flock(FHW, LOCK_UN); # unlock the file.
101 close FHW; # close the file.
105 # The folder is empty and delete the corresponding '.pl' file.
106 unlink($IntAutoScript);
107 print "Deleted $IntAutoScript since it corresponded to an empty folder.\n";
112 { # This logic to make sure that it is written only once.
113 # Only if something is written into the intermediary auto script,
114 # only then make an entry of the intermediary auto script in nwauto.pl
115 print FHWA "print \`perl $IntAutoScript\`\;\n";
116 print FHWA "print \"\\n\\n\\n\"\;\n\n";
124 $dir = dirname($FileName); # Get the folder name
125 $base = basename($FileName); # Get the base name
126 ($base, $dir, $ext) = fileparse($FileName, '\..*'); # Get the extension of the file passed.
128 # Do the processing only if the file has '.t' extension.
131 print FHWA "print \`perl $FileName\`\;\n";
132 print FHWA "print \"\\n\\n\\n\"\;\n\n";
139 ## Below adds the ending comments into all the intermediary auto scripts:
141 opendir(DIR, $DirName);
142 @Dirs = readdir(DIR);
144 foreach $DirItem(@Dirs)
148 $FileName = $DirName."/".$DirItem;
150 { # If an item is a folder, then open it further.
152 opendir(SUBDIR, $FileName);
153 @SubDirs = readdir(SUBDIR);
156 # To not to write into the file if the corresponding folder was empty.
157 foreach $SubDir(@SubDirs)
164 # The folder not empty.
166 # Intemediary automated script like base.pl, lib.pl, cmd.pl etc.
167 $IntAutoScript = "t/".$DirItem.".pl";
169 # Write into the intermediary auto script.
170 open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
171 seek(FHW, 0, 2); # seek to the end of the file.
172 flock(FHW, LOCK_EX); # Lock the file for safety purposes.
174 # Write into the intermediary auto script.
175 print FHW "\nprint \"Testing of $DirItem folder done!\\n\\n\"\;\n\n";
177 flock(FHW, LOCK_UN); # unlock the file.
178 close FHW; # close the file.
184 # Write into nwauto.pl
185 print FHWA "\nprint \"Automated Unit Testing of Perl$version for NetWare done!\\n\\n\"\;\n\n";
187 flock(FHWA, LOCK_UN); # unlock the file.
188 close FHWA; # close the file.
190 print "\n\nGeneration of t/nwauto.pl Done!\n\n";
192 print "\nGeneration of automated scripts for NetWare DONE!\n";
200 local($FileToProcess) = @_; # File name.
205 ## If the value of $FileToProcess is '/perl/scripts/t/pragma/warnings.t', then
206 ## $dir1 = '/perl/scripts/t/pragma/'
207 ## $base1 = 'warnings'
209 $dir1 = dirname($FileToProcess); # Get the folder name
210 $base1 = basename($FileToProcess); # Get the base name
211 ($base1, $dir1, $ext1) = fileparse($FileToProcess, '\..*'); # Get the extension of the file passed.
213 # Do the processing only if the file has '.t' extension.
216 foreach $Script(@ScriptsNotUsed)
218 # The variables are converted to lower case before they are compared.
219 # This is done to remove the case-sensitive comparison done by 'eq'.
220 $Script1 = lc($Script);
221 $FileToProcess1 = lc($FileToProcess);
222 if($Script1 eq $FileToProcess1)
230 # Write into the intermediary auto script.
234 # Write into the intermediary auto script.
235 print FHW "print \"Testing $base1"."$ext1:\\n\\n\"\;\n";
236 print FHW "print \`perl $FileToProcess\`\;\n"; # Write the changed array into the file.
237 print FHW "print \"\\n\\n\\n\"\;\n";
241 # Write into the intermediary auto script.