[LON-CAPA-cvs] cvs: modules /jerf/tests lonhelpTest.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 08 Aug 2003 18:30:31 -0000


bowersj2		Fri Aug  8 14:30:31 2003 EDT

  Modified files:              
    /modules/jerf/tests	lonhelpTest.pm 
  Log:
  Add a test to try to make sure the author manual and course manual are 
  generated correctly. It's working on Uhura but seems to be blowing up 
  elsewhere for unknown reasons; step one is detecting it.
  
  
Index: modules/jerf/tests/lonhelpTest.pm
diff -u modules/jerf/tests/lonhelpTest.pm:1.4 modules/jerf/tests/lonhelpTest.pm:1.5
--- modules/jerf/tests/lonhelpTest.pm:1.4	Tue Jul  8 14:15:15 2003
+++ modules/jerf/tests/lonhelpTest.pm	Fri Aug  8 14:30:31 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # lonhelp Handler Tester
 #
-# $Id: lonhelpTest.pm,v 1.4 2003/07/08 18:15:15 bowersj2 Exp $
+# $Id: lonhelpTest.pm,v 1.5 2003/08/08 18:30:31 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -196,6 +196,34 @@
     my $r = ApacheRequest->new({'uri' => '/adm/help/non-existant.hlp'});
     $r->doHandler('Apache::lonhelp');
     $self->assert($r->getReturnValue() == HTTP_NOT_FOUND);
+}
+
+sub test_help_files_at_least_may_be_correct {
+    my $self = shift;
+
+    # Seems like we're having trouble with the help PDF files being
+    # generated correctly. There's no way to check that they were
+    # generated perfectly correctly, but we're encountering situations
+    # where they are not even close to correct, which results in files
+    # that are way, way too small. We can at least check for that.
+
+    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeAuthorManual,
+        $atime,$mtime,$ctime,$blksize,$blocks) =
+        stat('/home/httpd/html/adm/help/author.manual.ps');
+    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,my $sizeCourseManual,
+                      $atime,$mtime,$ctime,$blksize,$blocks) =
+			  stat('/home/httpd/html/adm/help/course.manual.ps');
+    
+    # As of this writing, the author manual is 34MB and the course
+    # manual is 98K, so let's guess that anything less then 50K is
+    # bad.
+    my $cutoff = 50000;
+    print "$sizeAuthorManual $sizeCourseManual \n";
+    $self->assert($sizeAuthorManual > $cutoff && $sizeCourseManual >
+		  $cutoff, "Course Manual and/or the Author Manual ".
+		  "doesn't seem to be generated correctly; the " .
+		  "course manual was $sizeCourseManual bytes and " .
+		  "author manual was $sizeAuthorManual bytes.");
 }
 
 1;