@@ -5019,18 +5019,43 @@ def test_manual_pthread_proxy_hammer(self, args):
5019
5019
extra_tries = 0 )
5020
5020
5021
5021
5022
+ EMRUN = path_from_root ('emrun' )
5023
+
5024
+
5022
5025
class emrun (RunnerCore ):
5023
5026
def test_emrun_info (self ):
5024
5027
if not has_browser ():
5025
5028
self .skipTest ('need a browser' )
5026
- result = self .run_process ([path_from_root ( 'emrun' ) , '--system_info' , '--browser_info' ], stdout = PIPE ).stdout
5029
+ result = self .run_process ([EMRUN , '--system_info' , '--browser_info' ], stdout = PIPE ).stdout
5027
5030
assert 'CPU' in result
5028
5031
assert 'Browser' in result
5029
5032
assert 'Traceback' not in result
5030
5033
5031
- result = self .run_process ([path_from_root ( 'emrun' ) , '--list_browsers' ], stdout = PIPE ).stdout
5034
+ result = self .run_process ([EMRUN , '--list_browsers' ], stdout = PIPE ).stdout
5032
5035
assert 'Traceback' not in result
5033
5036
5037
+ def test_no_browser (self ):
5038
+ # Test --no_browser mode where we have to take care of launching the browser outselves
5039
+ # and killin emrun when we are done.
5040
+ if not has_browser ():
5041
+ self .skipTest ('need a browser' )
5042
+
5043
+ self .run_process ([EMCC , path_from_root ('tests' , 'test_emrun.c' ), '--emrun' , '-o' , 'hello_world.html' ])
5044
+ proc = subprocess .Popen ([EMRUN , '--no_browser' , '.' , '--port=3333' ], stdout = PIPE )
5045
+ try :
5046
+ if EMTEST_BROWSER :
5047
+ browser_cmd = shlex .split (EMTEST_BROWSER )
5048
+ browser = subprocess .Popen (browser_cmd + ['http://localhost:3333/hello_world.html' ])
5049
+ while True :
5050
+ stdout = proc .stdout .read ()
5051
+ if b'Dumping out file' in stdout :
5052
+ break
5053
+ browser .terminate ()
5054
+ browser .wait ()
5055
+ finally :
5056
+ proc .terminate ()
5057
+ proc .wait ()
5058
+
5034
5059
def test_emrun (self ):
5035
5060
self .run_process ([EMCC , path_from_root ('tests' , 'test_emrun.c' ), '--emrun' , '-o' , 'hello_world.html' ])
5036
5061
if not has_browser ():
@@ -5042,7 +5067,7 @@ def test_emrun(self):
5042
5067
# delete it. Therefore switch away from that directory before launching.
5043
5068
5044
5069
os .chdir (path_from_root ())
5045
- args_base = [path_from_root ( 'emrun' ) , '--timeout' , '30' , '--safe_firefox_profile' ,
5070
+ args_base = [EMRUN , '--timeout' , '30' , '--safe_firefox_profile' ,
5046
5071
'--kill_exit' , '--port' , '6939' , '--verbose' ,
5047
5072
'--log_stdout' , self .in_dir ('stdout.txt' ),
5048
5073
'--log_stderr' , self .in_dir ('stderr.txt' )]
0 commit comments