Skip to content

Commit 6b5982b

Browse files
committed
Remove (broken) EMTEST_BROWSER_PORT test setting
The `browser_reporting.js` file (which does most of the reporting these days) was not honoring it anyway. I've never found the need to configure this in all the years I've been working on emscripten so hopefully we don't need to bring it back.
1 parent 1604c82 commit 6b5982b

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

test/browser_reporting.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
var hasModule = typeof Module === 'object' && Module;
22

3-
/**
4-
* @param {number=} port
5-
*/
6-
function reportResultToServer(result, port) {
7-
port = port || 8888;
3+
var reportingURL = 'http://localhost:8888/';
4+
5+
function reportResultToServer(result) {
86
if (reportResultToServer.reported) {
97
// Only report one result per test, even if the test misbehaves and tries to report more.
108
reportErrorToServer(`excessive reported results, sending ${result}, test will fail`);
@@ -14,7 +12,7 @@ function reportResultToServer(result, port) {
1412
out(`RESULT: ${result}`);
1513
} else {
1614
let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch;
17-
doFetch(`http://localhost:${port}/report_result?${encodeURIComponent(result)}`).then(() => {
15+
doFetch(`${reportingURL}/report_result?${encodeURIComponent(result)}`).then(() => {
1816
if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) {
1917
/* for easy debugging, don't close window on failure */
2018
window.close();
@@ -24,26 +22,24 @@ function reportResultToServer(result, port) {
2422
}
2523

2624
function sendFileToServer(filename, contents) {
27-
fetch(`http://localhost:8888/?file=${encodeURIComponent(filename)}`, {method: "POST", body: contents});
25+
fetch(`${reportingURL}/?file=${encodeURIComponent(filename)}`, {method: "POST", body: contents});
2826
}
2927

30-
/**
31-
* @param {number=} port
32-
*/
33-
function maybeReportResultToServer(result, port) {
34-
if (reportResultToServer.reported) return;
35-
reportResultToServer(result, port);
28+
function maybeReportResultToServer(result) {
29+
if (!reportResultToServer.reported) {
30+
reportResultToServer(result);
31+
}
3632
}
3733

3834
function reportErrorToServer(message) {
3935
if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) {
4036
err(message);
4137
} else {
42-
fetch(`http://localhost:8888?stderr=${encodeURIComponent(message)}`);
38+
fetch(`${reportingURL}?stderr=${encodeURIComponent(message)}`);
4339
}
4440
}
4541

46-
function report_error(e) {
42+
function reportError(e) {
4743
// MINIMAL_RUNTIME doesn't handle exit or call the below onExit handler
4844
// so we detect the exit by parsing the uncaught exception message.
4945
var message = e.message || e;
@@ -68,9 +64,9 @@ function report_error(e) {
6864

6965
if (typeof window === 'object' && window) {
7066
window.addEventListener('error', event => {
71-
report_error(event.error || event)
67+
reportError(event.error || event)
7268
});
73-
window.addEventListener('unhandledrejection', event => report_error(event.reason));
69+
window.addEventListener('unhandledrejection', event => reportError(event.reason));
7470
}
7571

7672
if (hasModule) {

test/common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,8 @@ class BrowserCore(RunnerCore):
20742074
MAX_UNRESPONSIVE_TESTS = 10
20752075

20762076
unresponsive_tests = 0
2077+
port = 8888
2078+
browser_timeout = 60
20772079

20782080
def __init__(self, *args, **kwargs):
20792081
super().__init__(*args, **kwargs)
@@ -2106,10 +2108,8 @@ def browser_open(cls, url):
21062108
@classmethod
21072109
def setUpClass(cls):
21082110
super().setUpClass()
2109-
cls.port = int(os.getenv('EMTEST_BROWSER_PORT', '8888'))
21102111
if not has_browser() or EMTEST_BROWSER == 'node':
21112112
return
2112-
cls.browser_timeout = 60
21132113
cls.harness_in_queue = multiprocessing.Queue()
21142114
cls.harness_out_queue = multiprocessing.Queue()
21152115
cls.harness_server = multiprocessing.Process(target=harness_server_func, args=(cls.harness_in_queue, cls.harness_out_queue, cls.port))
@@ -2213,7 +2213,6 @@ def compile_btest(self, filename, args, reporting=Reporting.FULL):
22132213
# If C reporting (i.e. the REPORT_RESULT macro) is required we
22142214
# also include report_result.c and force-include report_result.h
22152215
self.run_process([EMCC, '-c', '-I' + TEST_ROOT,
2216-
'-DEMTEST_PORT_NUMBER=%d' % self.port,
22172216
test_file('report_result.c')] + self.get_emcc_args(compile_only=True) + (['-fPIC'] if '-fPIC' in args else []))
22182217
args += ['report_result.o', '-include', test_file('report_result.h')]
22192218
if EMTEST_BROWSER == 'node':

test/report_result.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,13 @@ extern "C" {
2020
#endif
2121

2222
#if defined __EMSCRIPTEN__ && !defined EMTEST_NODE
23-
#ifndef EMTEST_PORT_NUMBER
24-
#error "EMTEST_PORT_NUMBER not defined"
25-
#endif
2623

2724
void EMSCRIPTEN_KEEPALIVE _ReportResult(int result) {
28-
EM_ASM({
29-
reportResultToServer($0, $1);
30-
}, result, EMTEST_PORT_NUMBER);
25+
EM_ASM(reportResultToServer($0), result);
3126
}
3227

3328
void EMSCRIPTEN_KEEPALIVE _MaybeReportResult(int result) {
34-
EM_ASM({
35-
maybeReportResultToServer($0, $1);
36-
}, result, EMTEST_PORT_NUMBER);
29+
EM_ASM(maybeReportResultToServer($0), result);
3730
}
3831

3932
#else

0 commit comments

Comments
 (0)