add testing for EMCC_FORCE_STDLIBS=1 on dynamic linking

This commit is contained in:
Alon Zakai 2015-05-04 16:25:18 -07:00
Родитель d0ed46f3e4
Коммит 9c77d0fd9f
1 изменённых файлов: 30 добавлений и 25 удалений

Просмотреть файл

@ -3901,31 +3901,36 @@ var Module = {
''', expected=['main: jslib_x is 148.\nside: jslib_x is 148.\n'], main_emcc_args=['--js-library', 'lib.js']) ''', expected=['main: jslib_x is 148.\nside: jslib_x is 148.\n'], main_emcc_args=['--js-library', 'lib.js'])
def test_dylink_syslibs(self): # one module uses libcextra, need to force its inclusion when it isn't the main def test_dylink_syslibs(self): # one module uses libcextra, need to force its inclusion when it isn't the main
try: def test(syslibs):
os.environ['EMCC_FORCE_STDLIBS'] = 'libc,libcextra' print 'syslibs', syslibs
self.dylink_test(header=r''' try:
#include <string.h> os.environ['EMCC_FORCE_STDLIBS'] = syslibs
int side(); self.dylink_test(header=r'''
''', main=r''' #include <string.h>
#include <stdio.h> int side();
#include <wchar.h> ''', main=r'''
#include "header.h" #include <stdio.h>
int main() { #include <wchar.h>
printf("|%d|\n", side()); #include "header.h"
wprintf (L"Characters: %lc %lc\n", L'a', 65); int main() {
return 0; printf("|%d|\n", side());
} wprintf (L"Characters: %lc %lc\n", L'a', 65);
''', side=r''' return 0;
#include <stdlib.h> }
#include <malloc.h> ''', side=r'''
#include "header.h" #include <stdlib.h>
int side() { #include <malloc.h>
struct mallinfo m = mallinfo(); #include "header.h"
return m.arena > 1; int side() {
} struct mallinfo m = mallinfo();
''', expected=['|1|\nCharacters: a A\n']) return m.arena > 1;
finally: }
del os.environ['EMCC_FORCE_STDLIBS'] ''', expected=['|1|\nCharacters: a A\n'])
finally:
del os.environ['EMCC_FORCE_STDLIBS']
test('libc,libcextra')
test('1')
def test_dylink_iostream(self): def test_dylink_iostream(self):
try: try: