diff options
author | max99x <max99x@gmail.com> | 2011-08-25 16:04:06 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-08-25 16:05:24 +0300 |
commit | 58b8fa4ff05d62b3d9a6e793bb73118c23349897 (patch) | |
tree | 9575020b9a06aab978c6db2e42e3912a924b676b | |
parent | d689bcc09534d309cb207337e638ff2a2004a952 (diff) |
Added vprintf() test;
Skipping tests that use i64 vars when USE_TYPED_ARRAYS != 0;
Fixed incorrectly declared printf() in tests/cases/trunc.ll.
-rw-r--r-- | tests/cases/trunc.ll | 2 | ||||
-rw-r--r-- | tests/runner.py | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/cases/trunc.ll b/tests/cases/trunc.ll index 6af3656c..b46436ff 100644 --- a/tests/cases/trunc.ll +++ b/tests/cases/trunc.ll @@ -5,7 +5,7 @@ target triple = "i386-pc-linux-gnu" @.str = private constant [8 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1] ; [#uses=1] -declare i32 @printf(i8*) +declare i32 @printf(i8* noalias, ...) ; [#uses=0] define i32 @main() { diff --git a/tests/runner.py b/tests/runner.py index 8e946fef..e8cfba42 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -387,6 +387,7 @@ if 'benchmark' not in sys.argv: self.do_test(src, output, force_c=True) def test_bigint(self): + if USE_TYPED_ARRAYS != 0: return self.skip() # Typed arrays truncate i64. src = ''' #include <stdio.h> int main() @@ -2239,10 +2240,36 @@ if 'benchmark' not in sys.argv: self.do_test(src, re.sub(r'\n\s+', '\n', expected)) def test_printf(self): + if USE_TYPED_ARRAYS != 0: return self.skip() # Typed arrays truncate i64. src = open(path_from_root('tests', 'printf', 'test.c'), 'r').read() expected = open(path_from_root('tests', 'printf', 'output.txt'), 'r').read() self.do_test(src, expected) + def test_vprintf(self): + src = r''' + #include <stdio.h> + #include <stdarg.h> + + void print(char* format, ...) { + va_list args; + va_start (args, format); + vprintf (format, args); + va_end (args); + } + + int main () { + print("Call with %d variable argument.\n", 1); + print("Call with %d variable %s.\n", 2, "arguments"); + + return 0; + } + ''' + expected = ''' + Call with 1 variable argument. + Call with 2 variable arguments. + ''' + self.do_test(src, re.sub('(^|\n)\s+', '\\1', expected)) + def test_langinfo(self): src = open(path_from_root('tests', 'langinfo', 'test.c'), 'r').read() expected = open(path_from_root('tests', 'langinfo', 'output.txt'), 'r').read() |