Skip to content

Commit 0c1d954

Browse files
authored
[test] Remove unused sync variant of ReportResult. NFC (#22020)
Split out from #22018.
1 parent 212c345 commit 0c1d954

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

test/browser_reporting.js

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

3-
/** @param {boolean=} sync
4-
@param {number=} port */
5-
function reportResultToServer(result, sync, port) {
3+
/**
4+
* @param {number=} port
5+
*/
6+
function reportResultToServer(result, port) {
67
port = port || 8888;
78
if (reportResultToServer.reported) {
89
// Only report one result per test, even if the test misbehaves and tries to report more.
@@ -13,7 +14,7 @@ function reportResultToServer(result, sync, port) {
1314
out('RESULT: ' + result);
1415
} else {
1516
var xhr = new XMLHttpRequest();
16-
xhr.open('GET', 'http://localhost:' + port + '/report_result?' + result, !sync);
17+
xhr.open('GET', 'http://localhost:' + port + '/report_result?' + result);
1718
xhr.send();
1819
if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) {
1920
/* for easy debugging, don't close window on failure */
@@ -22,11 +23,12 @@ function reportResultToServer(result, sync, port) {
2223
}
2324
}
2425

25-
/** @param {boolean=} sync
26-
@param {number=} port */
27-
function maybeReportResultToServer(result, sync, port) {
26+
/**
27+
* @param {number=} port
28+
*/
29+
function maybeReportResultToServer(result, port) {
2830
if (reportResultToServer.reported) return;
29-
reportResultToServer(result, sync, port);
31+
reportResultToServer(result, port);
3032
}
3133

3234
function reportErrorToServer(message) {

test/pthread/call_async_on_main_thread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ addToLibrary({
77
console.error('This function should be getting called on the main thread!');
88
}
99
console.log('got ' + param1 + ' ' + param2 + ' ' + param3);
10-
__ReportResult(param1 + param2 * param3, 0);
10+
__ReportResult(param1 + param2 * param3);
1111
}
1212
});

test/report_result.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ extern "C" {
2424
#error "EMTEST_PORT_NUMBER not defined"
2525
#endif
2626

27-
void EMSCRIPTEN_KEEPALIVE _ReportResult(int result, int sync) {
27+
void EMSCRIPTEN_KEEPALIVE _ReportResult(int result) {
2828
EM_ASM({
29-
reportResultToServer($0, $1, $2);
30-
}, result, sync, EMTEST_PORT_NUMBER);
29+
reportResultToServer($0, $1);
30+
}, result, EMTEST_PORT_NUMBER);
3131
}
3232

33-
void EMSCRIPTEN_KEEPALIVE _MaybeReportResult(int result, int sync) {
33+
void EMSCRIPTEN_KEEPALIVE _MaybeReportResult(int result) {
3434
EM_ASM({
35-
maybeReportResultToServer($0, $1, $2);
36-
}, result, sync, EMTEST_PORT_NUMBER);
35+
maybeReportResultToServer($0, $1);
36+
}, result, EMTEST_PORT_NUMBER);
3737
}
3838

3939
#else
4040

4141
static bool reported = false;
4242

43-
void _ReportResult(int result, int sync) {
43+
void _ReportResult(int result) {
4444
if (reported) {
4545
printf("ERROR: result already reported\n");
4646
exit(1);
@@ -49,8 +49,8 @@ void _ReportResult(int result, int sync) {
4949
printf("RESULT: %d\n", result);
5050
}
5151

52-
void _MaybeReportResult(int result, int sync) {
53-
if (!reported) _ReportResult(result, sync);
52+
void _MaybeReportResult(int result) {
53+
if (!reported) _ReportResult(result);
5454
}
5555

5656
#endif // __EMSCRIPTEN__ && !defined EMTEST_NODE

test/report_result.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* University of Illinois/NCSA Open Source License. Both these licenses can be
55
* found in the LICENSE file.
66
*
7-
* Define REPORT_RESULT and REPORT_RESULT_SYNC for using in test code
7+
* Define REPORT_RESULT for using in test code
88
*/
99

1010
#ifndef REPORT_RESULT_H_
@@ -16,8 +16,8 @@
1616
extern "C" {
1717
#endif
1818

19-
void _ReportResult(int result, int sync);
20-
void _MaybeReportResult(int result, int sync);
19+
void _ReportResult(int result);
20+
void _MaybeReportResult(int result);
2121

2222
#ifdef __cplusplus
2323
}
@@ -26,15 +26,11 @@ void _MaybeReportResult(int result, int sync);
2626
#if defined __EMSCRIPTEN__ && defined __EMSCRIPTEN_PTHREADS__ && !defined(__EMSCRIPTEN_WASM_WORKERS__)
2727
#include <emscripten.h>
2828
#include <emscripten/threading.h>
29-
#define REPORT_RESULT(result) emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_VII, _ReportResult, (result), 0)
30-
#define REPORT_RESULT_SYNC(result) emscripten_sync_run_in_main_runtime_thread(EM_FUNC_SIG_VII, _ReportResult, (result), 1)
31-
#define MAYBE_REPORT_RESULT(result) emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_VII, _MaybeReportResult, (result), 0)
32-
#define MAYBE_REPORT_RESULT_SYNC(result) emscripten_sync_run_in_main_runtime_thread(EM_FUNC_SIG_VII, _MaybeReportResult, (result), 1)
29+
#define REPORT_RESULT(result) emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_VI, _ReportResult, (result))
30+
#define MAYBE_REPORT_RESULT(result) emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_VI, _MaybeReportResult, (result))
3331
#else
34-
#define REPORT_RESULT(result) _ReportResult((result), 0)
35-
#define REPORT_RESULT_SYNC(result) _ReportResult((result), 1)
36-
#define MAYBE_REPORT_RESULT(result) _MaybeReportResult((result), 0)
37-
#define MAYBE_REPORT_RESULT_SYNC(result) _MaybeReportResult((result), 1)
32+
#define REPORT_RESULT(result) _ReportResult((result))
33+
#define MAYBE_REPORT_RESULT(result) _MaybeReportResult((result))
3834
#endif
3935

4036
#endif

test/webaudio/create_webaudio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main()
2424
if (audioContext.state != 'running') {
2525
audioContext.resume();
2626
#ifdef REPORT_RESULT
27-
__ReportResult(0, 0);
27+
__ReportResult(0);
2828
#endif
2929
} else {
3030
audioContext.suspend();

0 commit comments

Comments
 (0)