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