Skip to content

Commit

Permalink
Revert "Add test_dylink_function_pointer_equality test (emscripten-co…
Browse files Browse the repository at this point in the history
…re#8330)"

This reverts commit 3715670.
  • Loading branch information
VirtualTim authored May 23, 2019
1 parent e02ad3d commit 62b95f1
Showing 1 changed file with 17 additions and 51 deletions.
68 changes: 17 additions & 51 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,7 @@ def dylink_test(self, main, side, expected, header=None, main_emcc_args=[], forc
# side settings
self.clear_setting('MAIN_MODULE')
self.set_setting('SIDE_MODULE')
print(self.is_wasm())
side_suffix = 'wasm' if self.is_wasm() else 'js'
if isinstance(side, list):
# side is just a library
Expand Down Expand Up @@ -3245,60 +3246,25 @@ def dylink_test(self, main, side, expected, header=None, main_emcc_args=[], forc
print('flip')
self.dylink_test(side, main, expected, header, main_emcc_args, force_c, need_reverse=False)

def do_basic_dylink_test(self):
self.dylink_test(r'''
#include <stdio.h>
#include "header.h"
int main() {
printf("other says %d.\n", sidey());
return 0;
}
''', '''
#include "header.h"
int sidey() {
return 11;
}
''', 'other says 11.', 'extern "C" int sidey();')

@needs_dlfcn
def test_dylink_basics(self):
self.do_basic_dylink_test()

@needs_dlfcn
def test_dylink_memory_growth(self):
if not self.is_wasm():
self.skipTest('wasm only')
self.set_setting('ALLOW_MEMORY_GROWTH', 1)
self.do_basic_dylink_test()

@needs_dlfcn
def test_dylink_function_pointer_equality(self):
# TODO(sbc): This is currently a known failure.
# See https://github.com/emscripten-core/emscripten/issues/8268
self.dylink_test(r'''
#include <stdio.h>
#include "header.h"
int main() {
void* puts_side = get_address();
printf("main module address %p.\n", &puts);
printf("side module address address %p.\n", puts_side);
if (&puts == puts_side)
printf("success\n");
else
printf("failure\n");
return 0;
}
''', '''
#include <stdio.h>
#include "header.h"
def test():
self.dylink_test('''
#include <stdio.h>
extern "C" int sidey();
int main() {
printf("other says %d.\\n", sidey());
return 0;
}
''', '''
extern "C" int sidey() { return 11; }
''', 'other says 11.')
test()

void* get_address() {
return (void*)&puts;
}
''', 'failure', header='extern "C" void* get_address();')
if self.is_wasm():
print('test memory growth with dynamic linking, which works in wasm')
self.set_setting('ALLOW_MEMORY_GROWTH', 1)
test()

@needs_dlfcn
def test_dylink_floats(self):
Expand Down

0 comments on commit 62b95f1

Please sign in to comment.