From: Pierre-Marc Fournier Date: Mon, 1 Mar 2010 22:45:47 +0000 (-0500) Subject: move snprintf test suite to tests/snprintf/ and add test X-Git-Tag: v0.3~3 X-Git-Url: http://git.lttng.org/?p=ust.git;a=commitdiff_plain;h=69f1f6526a6d40556ed3dcb50cdc199f45793b2f move snprintf test suite to tests/snprintf/ and add test --- diff --git a/configure.ac b/configure.ac index 64a708a..c2728f7 100644 --- a/configure.ac +++ b/configure.ac @@ -118,6 +118,7 @@ AC_CONFIG_FILES([ tests/basic_long/Makefile tests/fork/Makefile tests/simple_include/Makefile + tests/snprintf/Makefile libmallocwrap/Makefile libinterfork/Makefile ustd/Makefile diff --git a/snprintf/Makefile.am b/snprintf/Makefile.am index 04148b7..5ef7d82 100644 --- a/snprintf/Makefile.am +++ b/snprintf/Makefile.am @@ -16,8 +16,3 @@ libustsnprintf_la_SOURCES = \ wsetup.c libustsnprintf_la_LDFLAGS = -no-undefined -version-info 0:0:0 -static libustsnprintf_la_CFLAGS = -DUST_COMPONENT="ust_snprintf" -fPIC - -check_PROGRAMS = prog -prog_SOURCES = prog.c -prog_LDADD = libustsnprintf.la -TESTS = prog diff --git a/snprintf/prog.c b/snprintf/prog.c deleted file mode 100644 index 157511b..0000000 --- a/snprintf/prog.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -int main() -{ - char buf[100]; - - char *expected; - - expected = "header 9999, hello, 003"; - ust_safe_snprintf(buf, 99, "header %d, %s, %03d", 9999, "hello", 3); - if(strcmp(buf, expected) != 0) { - printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf); - return 1; - } - - return 0; -} diff --git a/tests/Makefile.am b/tests/Makefile.am index 2ddaceb..abe446e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1 +1 @@ -SUBDIRS = hello hello2 basic basic_long fork simple_include +SUBDIRS = hello hello2 basic basic_long fork simple_include snprintf diff --git a/tests/snprintf/Makefile.am b/tests/snprintf/Makefile.am new file mode 100644 index 0000000..809531b --- /dev/null +++ b/tests/snprintf/Makefile.am @@ -0,0 +1,5 @@ +check_PROGRAMS = prog +prog_SOURCES = prog.c +prog_LDADD = $(top_builddir)/snprintf/libustsnprintf.la + +TESTS = prog diff --git a/tests/snprintf/prog.c b/tests/snprintf/prog.c new file mode 100644 index 0000000..c6116fe --- /dev/null +++ b/tests/snprintf/prog.c @@ -0,0 +1,18 @@ +#include +#include + +int main() +{ + char buf[100]; + + char *expected; + + expected = "header 9999, hello, 005, ' 9'"; + ust_safe_snprintf(buf, 99, "header %d, %s, %03d, '%3$*d'", 9999, "hello", 5, 9); + if(strcmp(buf, expected) != 0) { + printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf); + return 1; + } + + return 0; +}