Skip to content

Commit 7840305

Browse files
authored
Fix test_pthread_locale after #26486 (#26492)
This test was being very naughty indeed. The test was added back in 2017 in #4813, although its hard to say what exactly its purpose is.
1 parent 6ad2f5e commit 7840305

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

test/pthread/test_pthread_locale.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,16 @@
99
#include <pthread.h>
1010
#include <stdio.h>
1111
#include <stdlib.h>
12+
#include <locale.h>
1213
#include <emscripten/threading.h>
13-
// This is really rather naughty, we shouldn't be including
14-
// musl-internal headers like this.
15-
#define weak __attribute__(__weak__)
16-
#define hidden __attribute__((__visibility__("hidden")))
17-
#include "pthread_impl.h"
18-
19-
#define NUM_THREADS 1
2014

2115
locale_t do_test() {
2216
pthread_t thread = pthread_self();
23-
locale_t loc = thread->locale;
17+
locale_t loc = uselocale((locale_t)0);
2418
printf(" pthread_self() = %p\n", thread);
25-
printf(" pthread_self()->locale = %p\n", loc);
19+
printf(" current locale: %p\n", loc);
2620

27-
if (!loc) {
28-
puts("ERROR: loc is null");
29-
}
21+
assert(loc);
3022
return loc;
3123
}
3224

test/test_browser.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4576,8 +4576,6 @@ def test_fetch_redirect(self):
45764576
'mt': (['-pthread', '-sPTHREAD_POOL_SIZE=2'],),
45774577
})
45784578
def test_pthread_locale(self, args):
4579-
self.cflags.append('-I' + path_from_root('system/lib/libc/musl/src/internal'))
4580-
self.cflags.append('-I' + path_from_root('system/lib/pthread'))
45814579
self.btest_exit('pthread/test_pthread_locale.c', cflags=args)
45824580

45834581
# Tests the Emscripten HTML5 API emscripten_set_canvas_element_size() and

0 commit comments

Comments
 (0)