diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/floatreturningfuncptr.ll | 18 | ||||
-rwxr-xr-x | tests/runner.py | 41 |
2 files changed, 52 insertions, 7 deletions
diff --git a/tests/cases/floatreturningfuncptr.ll b/tests/cases/floatreturningfuncptr.ll new file mode 100644 index 00000000..e07e97b3 --- /dev/null +++ b/tests/cases/floatreturningfuncptr.ll @@ -0,0 +1,18 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + %call = call float (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] + %call2 = call float (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), float %call) ; [#uses=0 type=i32] + ret i32 1 +} + +; [#uses=1] +declare float @printf(i8*, ...) diff --git a/tests/runner.py b/tests/runner.py index fc58e386..b0338855 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -2475,17 +2475,14 @@ Exception execution path of first function! 1 def test_exceptions(self): if Settings.ASM_JS: return self.skip('no exceptions support in asm') if Settings.QUANTUM_SIZE == 1: return self.skip("we don't support libcxx in q1") + if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly') Settings.EXCEPTION_DEBUG = 1 self.banned_js_engines = [NODE_JS] # node issue 1669, exception causes stdout not to be flushed Settings.DISABLE_EXCEPTION_CATCHING = 0 - if self.emcc_args is None: - if Building.LLVM_OPTS: return self.skip('optimizing bitcode before emcc can confuse libcxx inclusion') - self.emcc_args = [] # libc++ auto-inclusion is only done if we use emcc - else: - if '-O2' in self.emcc_args: - self.emcc_args += ['--closure', '1'] # Use closure here for some additional coverage + if '-O2' in self.emcc_args: + self.emcc_args += ['--closure', '1'] # Use closure here for some additional coverage src = ''' #include <stdio.h> @@ -6245,6 +6242,36 @@ def process(filename): } ''' self.do_run(src, "some string constant") + + def test_std_cout_new(self): + if self.emcc_args is None: return self.skip('requires emcc') + + src = ''' + #include <iostream> + + struct NodeInfo { //structure that we want to transmit to our shaders + float x; + float y; + float s; + float c; + }; + const int nbNodes = 100; + NodeInfo * data = new NodeInfo[nbNodes]; //our data that will be transmitted using float texture. + + template<int i> + void printText( const char (&text)[ i ] ) + { + std::cout << text << std::endl; + } + + int main() + { + printText( "some string constant" ); + return 0; + } + ''' + + self.do_run(src, "some string constant") def test_istream(self): if self.emcc_args is None: return self.skip('requires libcxx') @@ -10075,7 +10102,7 @@ f.close() (1, 0, 3, 2), (1, 1, 3, 4) ]: print asm, linkable, chunks, js_chunks - output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm, '-s', 'UNRESOLVED_AS_DEAD=1'], stdout=PIPE, stderr=PIPE).communicate() + output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm, '-s', 'UNRESOLVED_AS_DEAD=1'] + (['-O2'] if asm else []), stdout=PIPE, stderr=PIPE).communicate() ok = False for c in range(chunks, chunks+2): ok = ok or ('phase 2 working on %d chunks' % c in err) |