From 69d6ee6e54c463d2673a1c7809c12b4b8d7ff382 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 17 Oct 2018 16:07:56 -0400 Subject: [PATCH] tests: hello-many Signed-off-by: Mathieu Desnoyers --- configure.ac | 1 + tests/Makefile.am | 2 +- tests/hello-many/Makefile.am | 13 ++ tests/hello-many/README | 2 + tests/hello-many/hello-many.c | 50 +++++ tests/hello-many/tp.c | 26 +++ tests/hello-many/ust_tests_hello_many.h | 239 ++++++++++++++++++++++++ 7 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 tests/hello-many/Makefile.am create mode 100644 tests/hello-many/README create mode 100644 tests/hello-many/hello-many.c create mode 100644 tests/hello-many/tp.c create mode 100644 tests/hello-many/ust_tests_hello_many.h diff --git a/configure.ac b/configure.ac index 1c89512c..a3e1e238 100644 --- a/configure.ac +++ b/configure.ac @@ -547,6 +547,7 @@ AC_CONFIG_FILES([ tests/Makefile tests/ctf-types/Makefile tests/hello/Makefile + tests/hello-many/Makefile tests/hello.cxx/Makefile tests/same_line_tracepoint/Makefile tests/snprintf/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index 935c7546..c8505eb5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = utils hello same_line_tracepoint snprintf benchmark ust-elf \ - ctf-types test-app-ctx gcc-weak-hidden + ctf-types test-app-ctx gcc-weak-hidden hello-many if CXX_WORKS SUBDIRS += hello.cxx diff --git a/tests/hello-many/Makefile.am b/tests/hello-many/Makefile.am new file mode 100644 index 00000000..338b7986 --- /dev/null +++ b/tests/hello-many/Makefile.am @@ -0,0 +1,13 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -Wsystem-headers + +noinst_PROGRAMS = hello-many +hello_many_SOURCES = hello-many.c tp.c ust_tests_hello_many.h +hello_many_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la +hello_many_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS) + +if LTTNG_UST_BUILD_WITH_LIBDL +hello_many_LDADD += -ldl +endif +if LTTNG_UST_BUILD_WITH_LIBC_DL +hello_many_LDADD += -lc +endif diff --git a/tests/hello-many/README b/tests/hello-many/README new file mode 100644 index 00000000..a2572546 --- /dev/null +++ b/tests/hello-many/README @@ -0,0 +1,2 @@ +This is a "hello world" application used to verify that an instrumented +program which contains more than 30 tracepoints can be built successfully. diff --git a/tests/hello-many/hello-many.c b/tests/hello-many/hello-many.c new file mode 100644 index 00000000..eb1e4714 --- /dev/null +++ b/tests/hello-many/hello-many.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Pierre-Marc Fournier + * Copyright (C) 2011 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TRACEPOINT_DEFINE +#include "ust_tests_hello_many.h" + +int main(int argc, char **argv) +{ + int delay = 0; + + if (argc == 2) + delay = atoi(argv[1]); + + fprintf(stderr, "Hello, World!\n"); + + sleep(delay); + + fprintf(stderr, "Tracing... "); + tracepoint(ust_tests_hello_many, tptest_simple1); + tracepoint(ust_tests_hello_many, tptest_simple34); + fprintf(stderr, " done.\n"); + return 0; +} diff --git a/tests/hello-many/tp.c b/tests/hello-many/tp.c new file mode 100644 index 00000000..ed5e8ce9 --- /dev/null +++ b/tests/hello-many/tp.c @@ -0,0 +1,26 @@ +/* + * tp.c + * + * Copyright (c) 2011 Mathieu Desnoyers + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#define TRACEPOINT_CREATE_PROBES +#include "ust_tests_hello_many.h" diff --git a/tests/hello-many/ust_tests_hello_many.h b/tests/hello-many/ust_tests_hello_many.h new file mode 100644 index 00000000..c5f82b68 --- /dev/null +++ b/tests/hello-many/ust_tests_hello_many.h @@ -0,0 +1,239 @@ +#undef TRACEPOINT_PROVIDER +#define TRACEPOINT_PROVIDER ust_tests_hello_many + +#if !defined(_TRACEPOINT_UST_TESTS_HELLO_MANY_H) || defined(TRACEPOINT_HEADER_MULTI_READ) +#define _TRACEPOINT_UST_TESTS_HELLO_MANY_H + +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +#include + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple1, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple2, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple3, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple4, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple5, + TP_ARGS(), + TP_FIELDS() +) + + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple6, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple7, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple8, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple9, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple10, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple11, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple12, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple13, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple14, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple15, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple16, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple17, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple18, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple19, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple20, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple21, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple22, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple23, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple24, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple25, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple26, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple27, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple28, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple29, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple30, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple31, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple32, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple33, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple34, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple35, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple36, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple37, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple38, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple39, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT(ust_tests_hello_many, tptest_simple40, + TP_ARGS(), + TP_FIELDS() +) + +#endif /* _TRACEPOINT_UST_TESTS_HELLO_MANY_H */ + +#undef TRACEPOINT_INCLUDE +#define TRACEPOINT_INCLUDE "./ust_tests_hello_many.h" + +/* This part must be outside ifdef protection */ +#include -- 2.34.1