Skip to content

Commit 616de6b

Browse files
authored
Possibly fix flaky test seen to error in wasm2js3.test_stat_chmod_wasmfs. (#24989)
`time_t` is `long long`, test has a narrowing conversion to `int`. Fails nondeterministically in http://clbri.com:8010/api/v2/logs/20165/raw_inline
1 parent 9aece71 commit 616de6b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/stat/test_chmod.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void create_file(const char *path, const char *buffer, int mode) {
2222
int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
2323
assert(fd >= 0);
2424

25-
int err = write(fd, buffer, sizeof(char) * strlen(buffer));
25+
int err = (int)write(fd, buffer, sizeof(char) * strlen(buffer));
2626
assert(err == (sizeof(char) * strlen(buffer)));
2727

2828
close(fd);
@@ -44,8 +44,8 @@ void cleanup() {
4444

4545
void test() {
4646
int err;
47-
int lastctime;
48-
int lastmtime;
47+
time_t lastctime;
48+
time_t lastmtime;
4949
struct stat s;
5050

5151
//
@@ -129,7 +129,7 @@ void test() {
129129

130130
#ifndef WASMFS // TODO https://github.com/emscripten-core/emscripten/issues/15948
131131
lstat("file-link", &s);
132-
int link_mode = s.st_mode;
132+
mode_t link_mode = s.st_mode;
133133
assert((link_mode & 0777) != S_IRUSR);
134134

135135
//

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5686,7 +5686,7 @@ def test_stat_chmod(self):
56865686
self.skipTest('mode bits work differently on windows')
56875687
if nodefs and self.get_setting('WASMFS'):
56885688
self.skipTest('test requires symlink creation which currently missing from wasmfs+noderawfs')
5689-
self.do_runf('stat/test_chmod.c', 'success')
5689+
self.do_runf('stat/test_chmod.c', 'success', cflags=['-Werror=conversion'])
56905690

56915691
@also_with_wasmfs
56925692
def test_stat_mknod(self):

0 commit comments

Comments
 (0)