Closed Bug 62187 Opened 24 years ago Closed 22 years ago

JS shell producing too much console output on Mac

Categories

(Core :: JavaScript Engine, defect, P3)

PowerPC
Mac System 9.x
defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: pschwartau, Assigned: pschwartau)

Details

Note this part of bug 61966:


-------------------------------------------------------------------------------
ecma/Math/15.8.2.14.js is the worst: it crashes. But it's peculiar;
if I do this in the JS shell, it does not crash and the test passes:

./js
js> load('../../tests/ecma/shell.js');
js> load('../../tests/ecma/Math/15.8.2.14.js')
15.8.2.14 Math.random()
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
             .
            etc. 
            etc.



HOWEVER, if I do this (as the test driver does), I get a crash (on Linux):

./js -f ../../tests/ecma/shell.js -f ../../tests/ecma/Math/15.8.2.14.js
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
             .
            etc. 
            etc.
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Segmentation fault(core dumped)
-------------------------------------------------------------------------------



OK, that's how it began. Mike was also able to reproduce this. 


But with today's pull of js/src, all my testcases are failing on the Mac
for apparently the same reason. They don't crash per se, but produce this error:


                  ReferenceError: test is not defined



Each testcase (the second -f option above) contains a function called "test":

function test()
{
 // run the testcase -
}


For some reason, when I use the two -f options, the JS shell on my Mac
is unable to recognize that the function "test" has been defined in the
second file. 


As with the Linux crash bug above, however, if I go into the JS shell first,
and use the load() function twice (once to load the shell.js file, and then
to load the testcase file), there is absolutely no problem -
The Mac problem goes away after the following adjustment to js.c:


--- js.c	
+++ js.cMAC	
@@ -97,7 +97,7 @@
 FILE *gOutFile = NULL;
 
 #ifdef XP_MAC
-#ifdef MAC_TEST_HACK
+#if defined(MAC_TEST_HACK) || defined(XP_MAC_MPW)
 /* this is the data file that all Print strings will be echoed into */
 FILE *gTestResultFile = NULL;
 #define isatty(f) 0
  


Without an adjustment such as above, running a JS testcase on my Mac 
produces hundreds of empty lines of output as follows:

js>
js>
js> 

     etc. 
     etc. 



After a certain number of these lines, the above failures occur. Reassigning 
to rginda, who explained this problem to me. I think we can close this bug 
once the Mac issue is resolved, and leave the Linux issue within bug 61966 -
Assignee: rogerl → rginda
Summary: The JS shell's -f option is not working correctly → The JS shell's -f option is not working correctly
Updating summary and changing OS to Mac only - 
OS: All → Mac System 9.x
Summary: The JS shell's -f option is not working correctly → JS shell producing too much console output on Mac
Marking future.
Target Milestone: --- → Future
Hardware: PC → Macintosh
Assigning to self -
Assignee: rginda → pschwartau
I spoke with Waldemar and rginda about checking in the one-line fix
outlined in Comment #1 above. Without this, running the test driver
is impossible on Mac 9. I've been using this patch my own Mac 9 tree
for some time, and have now checked it into the trunk.

Marking FIXED -
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Marking Verified -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.