JS shell producing too much console output on Mac

VERIFIED FIXED in Future

Status

()

Core
JavaScript Engine
P3
normal
VERIFIED FIXED
18 years ago
16 years ago

People

(Reporter: Phil Schwartau, Assigned: Phil Schwartau)

Tracking

Trunk
Future
PowerPC
Mac System 9.x
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

18 years ago
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 -
(Assignee)

Comment 1

18 years ago
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
(Assignee)

Comment 2

18 years ago
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

Comment 3

18 years ago
Marking future.
Target Milestone: --- → Future

Updated

17 years ago
Hardware: PC → Macintosh
(Assignee)

Comment 4

16 years ago
Assigning to self -
Assignee: rginda → pschwartau
(Assignee)

Comment 5

16 years ago
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
Last Resolved: 16 years ago
Resolution: --- → FIXED
(Assignee)

Comment 6

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