fix: remove 'src/' from modules install path
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 16 Feb 2021 21:51:47 +0000 (16:51 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Apr 2021 17:02:27 +0000 (13:02 -0400)
The move of the modules sources in the 'src/' subdirectory had the
unexpected side effect of adding 'src/' to the module install path
inside '/lib/modules/$(uname -r)/extra'. Adjust the Makefiles to return
to the initial behavior.

Change-Id: I280fe8a1e5ef367edeec0a6351351a233cc6f0be
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifcc64ea95c0e1435567150d976d42e3add3f7523

16 files changed:
Kbuild.common [deleted file]
Kconfig [deleted file]
Makefile
src/Kbuild
src/Kbuild.common [new file with mode: 0644]
src/Kconfig [new file with mode: 0644]
src/lib/Kbuild
src/probes/Kbuild
src/tests/Kbuild [new file with mode: 0644]
src/tests/Kconfig [new file with mode: 0644]
src/tests/clock-plugin/lttng-clock-plugin-test.c [new file with mode: 0644]
src/tests/probes/lttng-test.c [new file with mode: 0644]
tests/Kbuild [deleted file]
tests/Kconfig [deleted file]
tests/clock-plugin/lttng-clock-plugin-test.c [deleted file]
tests/probes/lttng-test.c [deleted file]

diff --git a/Kbuild.common b/Kbuild.common
deleted file mode 100644 (file)
index f64cb09..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
-
-ccflags-y += -DLTTNG_LINUX_MAJOR=$(VERSION)
-ccflags-y += -DLTTNG_LINUX_MINOR=$(PATCHLEVEL)
-ccflags-y += -DLTTNG_LINUX_PATCH=$(SUBLEVEL)
-
-# Work-around for distro-specific public modules ABI breakages.
-# Some distributions break the public module instrumentation ABI
-# compared to upstream stable kernels without providing other mean than
-# the kernel EXTRAVERSION to figure it out. Translate this information
-# into a define visible from the C preprocessor.
-
-DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
-
-ifneq ($(DEB_API_VERSION), 0)
-  ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
-endif
-
-RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
-
-ifneq ($(RHEL_API_VERSION), 0)
-  ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
-endif
-
-SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
-
-ifneq ($(SLE_API_VERSION), 0)
-  ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
-endif
-
-FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
-
-ifneq ($(FEDORA_REVISION_VERSION), 0)
-  ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
-endif
-
-RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
-
-ifneq ($(RT_PATCH_VERSION), 0)
-  ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
-endif
-
-EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
-
-ifneq ($(EXTRA_VERSION_NAME), 0)
-  ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
-endif
-
-EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
-
-ifneq ($(EXTRA_VERSION_GIT), 0)
-  ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
-endif
-
-EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
-
-mnt_ns_dep = $(srctree)/fs/mount.h
-ifeq ($(wildcard $(mnt_ns_dep)),)
-    ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER
-endif
-
-# vim:syntax=make
diff --git a/Kconfig b/Kconfig
deleted file mode 100644 (file)
index 85946fa..0000000
--- a/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-config LTTNG
-       tristate "LTTng support"
-       select TRACING
-       help
-         LTTng is an open source tracing framework for Linux.
-
-         See https://lttng.org/
-
-         To compile as a set of modules, choose M here. To compile into
-         the Linux kernel image, choose Y.
-
-         If unsure, say N.
-
-source "lttng/tests/Kconfig"
index c586efedc8c52538308fc9f81d3373d34709dc2b..37eb389b4771a12331e5a85e28b59ecb99c154ea 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,33 +2,10 @@
 
 ifneq ($(KERNELRELEASE),)
 
-  # This part of the Makefile is used when called by the kernel build system
-  # and defines the modules to be built.
-
-  ifdef CONFIG_LOCALVERSION    # Check if dot-config is included.
-    ifeq ($(CONFIG_TRACEPOINTS),)
-      $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
-    endif # CONFIG_TRACEPOINTS
-  endif # ifdef CONFIG_LOCALVERSION
-
-  TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))
-
-  lttng_check_linux_version = $(shell pwd)/include/linux/version.h
-  lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
-
-  #
-  # Check for stale version.h, which can be a leftover from an old Linux
-  # kernel tree moved to a newer kernel version, only pruned by make
-  # distclean.
-  #
-  ifneq ($(wildcard $(lttng_check_linux_version)),)
-    ifneq ($(wildcard $(lttng_check_generated_linux_version)),)
-      $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file)
-    endif
-  endif
-
-  obj-$(CONFIG_LTTNG) += src/
-  obj-$(CONFIG_LTTNG) += tests/
+# This part of the Makefile is used when called by the kernel build system
+# and defines the modules to be built.
+
+obj-$(CONFIG_LTTNG) += src/
 
 else # KERNELRELEASE
 
@@ -43,15 +20,15 @@ CFLAGS = $(EXTCFLAGS)
 default: modules
 
 modules:
-       $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules
+       $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules
 
 modules_install:
-       $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install
+       $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install
 
 clean:
-       $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+       $(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean
 
 %.i: %.c
-       $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@
+       $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@
 
 endif # KERNELRELEASE
index e7593fd8db10d08c31d6e7675739f6680388730a..a5a840a7d900bb315cfdf34e7772469e4c026dfa 100644 (file)
@@ -1,8 +1,28 @@
 # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
 
+ifdef CONFIG_LOCALVERSION      # Check if dot-config is included.
+  ifeq ($(CONFIG_TRACEPOINTS),)
+    $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
+  endif # CONFIG_TRACEPOINTS
+endif # ifdef CONFIG_LOCALVERSION
+
 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
 
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+lttng_check_linux_version = $(shell pwd)/include/linux/version.h
+lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
+
+#
+# Check for stale version.h, which can be a leftover from an old Linux
+# kernel tree moved to a newer kernel version, only pruned by make
+# distclean.
+#
+ifneq ($(wildcard $(lttng_check_linux_version)),)
+  ifneq ($(wildcard $(lttng_check_generated_linux_version)),)
+    $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file)
+  endif
+endif
+
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
 
 ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
 
@@ -125,3 +145,4 @@ lttng-statedump-objs := lttng-statedump-impl.o
 
 obj-$(CONFIG_LTTNG) += probes/
 obj-$(CONFIG_LTTNG) += lib/
+obj-$(CONFIG_LTTNG) += tests/
diff --git a/src/Kbuild.common b/src/Kbuild.common
new file mode 100644 (file)
index 0000000..f64cb09
--- /dev/null
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
+
+ccflags-y += -DLTTNG_LINUX_MAJOR=$(VERSION)
+ccflags-y += -DLTTNG_LINUX_MINOR=$(PATCHLEVEL)
+ccflags-y += -DLTTNG_LINUX_PATCH=$(SUBLEVEL)
+
+# Work-around for distro-specific public modules ABI breakages.
+# Some distributions break the public module instrumentation ABI
+# compared to upstream stable kernels without providing other mean than
+# the kernel EXTRAVERSION to figure it out. Translate this information
+# into a define visible from the C preprocessor.
+
+DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
+
+ifneq ($(DEB_API_VERSION), 0)
+  ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
+endif
+
+RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
+
+ifneq ($(RHEL_API_VERSION), 0)
+  ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
+endif
+
+SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
+
+ifneq ($(SLE_API_VERSION), 0)
+  ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
+endif
+
+FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
+
+ifneq ($(FEDORA_REVISION_VERSION), 0)
+  ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
+endif
+
+RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
+
+ifneq ($(RT_PATCH_VERSION), 0)
+  ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
+endif
+
+EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
+
+ifneq ($(EXTRA_VERSION_NAME), 0)
+  ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
+endif
+
+EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
+
+ifneq ($(EXTRA_VERSION_GIT), 0)
+  ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
+endif
+
+EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
+
+mnt_ns_dep = $(srctree)/fs/mount.h
+ifeq ($(wildcard $(mnt_ns_dep)),)
+    ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER
+endif
+
+# vim:syntax=make
diff --git a/src/Kconfig b/src/Kconfig
new file mode 100644 (file)
index 0000000..85946fa
--- /dev/null
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+config LTTNG
+       tristate "LTTng support"
+       select TRACING
+       help
+         LTTng is an open source tracing framework for Linux.
+
+         See https://lttng.org/
+
+         To compile as a set of modules, choose M here. To compile into
+         the Linux kernel image, choose Y.
+
+         If unsure, say N.
+
+source "lttng/tests/Kconfig"
index b0f49b6b704ad8093ffab4cba21911e9c4682ff9..b356736cb53fa74842defbdaa752046382eadfe8 100644 (file)
@@ -2,7 +2,7 @@
 
 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
 
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
 
 ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
 
index 0fc7e9c2b50c1db156c5cf251320d95f10f3d341..e26b4359e7638c010e73b6ffd6ea49da78b478df 100644 (file)
@@ -2,7 +2,7 @@
 
 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
 
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
 
 ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
 
diff --git a/src/tests/Kbuild b/src/tests/Kbuild
new file mode 100644 (file)
index 0000000..9cf1334
--- /dev/null
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
+
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
+
+ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
+
+obj-$(CONFIG_LTTNG) += lttng-test.o
+lttng-test-objs := probes/lttng-test.o
+
+obj-$(CONFIG_LTTNG_CLOCK_PLUGIN_TEST) += lttng-clock-plugin-test.o
+lttng-clock-plugin-test-objs := clock-plugin/lttng-clock-plugin-test.o
+
+# vim:syntax=make
diff --git a/src/tests/Kconfig b/src/tests/Kconfig
new file mode 100644 (file)
index 0000000..974fa10
--- /dev/null
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+config LTTNG_CLOCK_PLUGIN_TEST
+       tristate "Use test plugin as trace clock"
+       depends on LTTNG
+       help
+        Use the test clock as trace clock. This plugin freezes the
+        time with 1 KHz for regression test.
+        It's recommended to build this as a module to work with the
+        lttng-tools test suite.
diff --git a/src/tests/clock-plugin/lttng-clock-plugin-test.c b/src/tests/clock-plugin/lttng-clock-plugin-test.c
new file mode 100644 (file)
index 0000000..6c4213b
--- /dev/null
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-clock-plugin-test.c
+ *
+ * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <linux/module.h>
+#include <linux/ktime.h>
+#include <linux/hrtimer.h>
+#include <linux/time.h>
+
+#include <lttng/tracer.h>
+#include <lttng/clock.h>       /* From lttng-modules */
+
+static u64 trace_clock_read64_example(void)
+{
+       /* Freeze time. */
+       return 0;
+}
+
+static u64 trace_clock_freq_example(void)
+{
+       return 1000;    /* 1KHz */
+}
+
+static int trace_clock_uuid_example(char *uuid)
+{
+       const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
+       memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
+       return 0;
+}
+
+static const char *trace_clock_name_example(void)
+{
+       return "lttng_test_clock_override";
+}
+
+static const char *trace_clock_description_example(void)
+{
+       return "Freeze time with 1KHz for regression test";
+}
+
+static
+struct lttng_trace_clock ltc = {
+       .read64 = trace_clock_read64_example,
+       .freq = trace_clock_freq_example,
+       .uuid = trace_clock_uuid_example,
+       .name = trace_clock_name_example,
+       .description = trace_clock_description_example,
+};
+
+static __init
+int lttng_clock_plugin_init(void)
+{
+       return lttng_clock_register_plugin(&ltc, THIS_MODULE);
+}
+fs_initcall(lttng_clock_plugin_init);
+
+static __exit
+void lttng_clock_plugin_exit(void)
+{
+       lttng_clock_unregister_plugin(&ltc, THIS_MODULE);
+}
+module_exit(lttng_clock_plugin_exit);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng Clock Plugin Example");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+       LTTNG_MODULES_EXTRAVERSION);
diff --git a/src/tests/probes/lttng-test.c b/src/tests/probes/lttng-test.c
new file mode 100644 (file)
index 0000000..86007e5
--- /dev/null
@@ -0,0 +1,144 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-test.c
+ *
+ * Linux Trace Toolkit Next Generation Test Module
+ *
+ * Copyright 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/byteorder/generic.h>
+#include <asm/byteorder.h>
+
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <wrapper/tracepoint.h>
+
+#define TP_MODULE_NOAUTOLOAD
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH instrumentation/events
+#define TRACE_INCLUDE_FILE lttng-test
+#define LTTNG_INSTRUMENTATION
+#include <instrumentation/events/lttng-test.h>
+
+LTTNG_DEFINE_TRACE(lttng_test_filter_event,
+       PARAMS(int anint, int netint, long *values,
+               char *text, size_t textlen,
+               char *etext, uint32_t * net_values),
+       PARAMS(anint, netint, values, text, textlen, etext, net_values)
+);
+
+#define LTTNG_TEST_FILTER_EVENT_FILE   "lttng-test-filter-event"
+
+#define LTTNG_WRITE_COUNT_MAX  64
+
+static struct proc_dir_entry *lttng_test_filter_event_dentry;
+
+static
+void trace_test_event(unsigned int nr_iter)
+{
+       int i, netint;
+       long values[] = { 1, 2, 3 };
+       uint32_t net_values[] = { 1, 2, 3 };
+       char text[10] = "test";
+       char escape[10] = "\\*";
+
+       for (i = 0; i < 3; i++) {
+               net_values[i] = htonl(net_values[i]);
+       }
+       for (i = 0; i < nr_iter; i++) {
+               netint = htonl(i);
+               trace_lttng_test_filter_event(i, netint, values, text, strlen(text), escape, net_values);
+       }
+}
+
+/**
+ * lttng_filter_event_write - trigger a lttng_test_filter_event
+ * @file: file pointer
+ * @user_buf: user string
+ * @count: length to copy
+ *
+ * Return -1 on error, with EFAULT errno. Returns count on success.
+ */
+static
+ssize_t lttng_test_filter_event_write(struct file *file, const char __user *user_buf,
+                   size_t count, loff_t *ppos)
+{
+       unsigned int nr_iter;
+       ssize_t written;
+       int ret;
+
+       /* Get the number of iterations */
+       ret = kstrtouint_from_user(user_buf, count, 10, &nr_iter);
+       if (ret) {
+               written = ret;
+               goto end;
+       }
+       /* Trace the event */
+       trace_test_event(nr_iter);
+       written = count;
+       *ppos += written;
+end:
+       return written;
+}
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
+static const struct proc_ops lttng_test_filter_event_proc_ops = {
+       .proc_write = lttng_test_filter_event_write,
+};
+#else
+static const struct file_operations lttng_test_filter_event_proc_ops = {
+       .write = lttng_test_filter_event_write,
+};
+#endif
+
+static
+int __init lttng_test_init(void)
+{
+       int ret = 0;
+
+       (void) wrapper_lttng_fixup_sig(THIS_MODULE);
+       wrapper_vmalloc_sync_mappings();
+       lttng_test_filter_event_dentry =
+                       proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE,
+                               S_IRUGO | S_IWUGO, NULL,
+                               &lttng_test_filter_event_proc_ops, NULL);
+       if (!lttng_test_filter_event_dentry) {
+               printk(KERN_ERR "Error creating LTTng test filter file\n");
+               ret = -ENOMEM;
+               goto error;
+       }
+       ret = __lttng_events_init__lttng_test();
+       if (ret)
+               goto error_events;
+       return ret;
+
+error_events:
+       remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
+error:
+       return ret;
+}
+
+module_init(lttng_test_init);
+
+static
+void __exit lttng_test_exit(void)
+{
+       __lttng_events_exit__lttng_test();
+       if (lttng_test_filter_event_dentry)
+               remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
+}
+
+module_exit(lttng_test_exit);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng Test");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+       LTTNG_MODULES_EXTRAVERSION);
diff --git a/tests/Kbuild b/tests/Kbuild
deleted file mode 100644 (file)
index 906cbac..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
-
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
-
-ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
-
-obj-$(CONFIG_LTTNG) += lttng-test.o
-lttng-test-objs := probes/lttng-test.o
-
-obj-$(CONFIG_LTTNG_CLOCK_PLUGIN_TEST) += lttng-clock-plugin-test.o
-lttng-clock-plugin-test-objs := clock-plugin/lttng-clock-plugin-test.o
-
-# vim:syntax=make
diff --git a/tests/Kconfig b/tests/Kconfig
deleted file mode 100644 (file)
index 974fa10..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-config LTTNG_CLOCK_PLUGIN_TEST
-       tristate "Use test plugin as trace clock"
-       depends on LTTNG
-       help
-        Use the test clock as trace clock. This plugin freezes the
-        time with 1 KHz for regression test.
-        It's recommended to build this as a module to work with the
-        lttng-tools test suite.
diff --git a/tests/clock-plugin/lttng-clock-plugin-test.c b/tests/clock-plugin/lttng-clock-plugin-test.c
deleted file mode 100644 (file)
index 6c4213b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-clock-plugin-test.c
- *
- * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/module.h>
-#include <linux/ktime.h>
-#include <linux/hrtimer.h>
-#include <linux/time.h>
-
-#include <lttng/tracer.h>
-#include <lttng/clock.h>       /* From lttng-modules */
-
-static u64 trace_clock_read64_example(void)
-{
-       /* Freeze time. */
-       return 0;
-}
-
-static u64 trace_clock_freq_example(void)
-{
-       return 1000;    /* 1KHz */
-}
-
-static int trace_clock_uuid_example(char *uuid)
-{
-       const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
-       memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
-       return 0;
-}
-
-static const char *trace_clock_name_example(void)
-{
-       return "lttng_test_clock_override";
-}
-
-static const char *trace_clock_description_example(void)
-{
-       return "Freeze time with 1KHz for regression test";
-}
-
-static
-struct lttng_trace_clock ltc = {
-       .read64 = trace_clock_read64_example,
-       .freq = trace_clock_freq_example,
-       .uuid = trace_clock_uuid_example,
-       .name = trace_clock_name_example,
-       .description = trace_clock_description_example,
-};
-
-static __init
-int lttng_clock_plugin_init(void)
-{
-       return lttng_clock_register_plugin(&ltc, THIS_MODULE);
-}
-fs_initcall(lttng_clock_plugin_init);
-
-static __exit
-void lttng_clock_plugin_exit(void)
-{
-       lttng_clock_unregister_plugin(&ltc, THIS_MODULE);
-}
-module_exit(lttng_clock_plugin_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
-MODULE_DESCRIPTION("LTTng Clock Plugin Example");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
-       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-       LTTNG_MODULES_EXTRAVERSION);
diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c
deleted file mode 100644 (file)
index 86007e5..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-test.c
- *
- * Linux Trace Toolkit Next Generation Test Module
- *
- * Copyright 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-#include <linux/byteorder/generic.h>
-#include <asm/byteorder.h>
-
-#include <lttng/events.h>
-#include <lttng/tracer.h>
-#include <wrapper/tracepoint.h>
-
-#define TP_MODULE_NOAUTOLOAD
-#define LTTNG_PACKAGE_BUILD
-#define CREATE_TRACE_POINTS
-#define TRACE_INCLUDE_PATH instrumentation/events
-#define TRACE_INCLUDE_FILE lttng-test
-#define LTTNG_INSTRUMENTATION
-#include <instrumentation/events/lttng-test.h>
-
-LTTNG_DEFINE_TRACE(lttng_test_filter_event,
-       PARAMS(int anint, int netint, long *values,
-               char *text, size_t textlen,
-               char *etext, uint32_t * net_values),
-       PARAMS(anint, netint, values, text, textlen, etext, net_values)
-);
-
-#define LTTNG_TEST_FILTER_EVENT_FILE   "lttng-test-filter-event"
-
-#define LTTNG_WRITE_COUNT_MAX  64
-
-static struct proc_dir_entry *lttng_test_filter_event_dentry;
-
-static
-void trace_test_event(unsigned int nr_iter)
-{
-       int i, netint;
-       long values[] = { 1, 2, 3 };
-       uint32_t net_values[] = { 1, 2, 3 };
-       char text[10] = "test";
-       char escape[10] = "\\*";
-
-       for (i = 0; i < 3; i++) {
-               net_values[i] = htonl(net_values[i]);
-       }
-       for (i = 0; i < nr_iter; i++) {
-               netint = htonl(i);
-               trace_lttng_test_filter_event(i, netint, values, text, strlen(text), escape, net_values);
-       }
-}
-
-/**
- * lttng_filter_event_write - trigger a lttng_test_filter_event
- * @file: file pointer
- * @user_buf: user string
- * @count: length to copy
- *
- * Return -1 on error, with EFAULT errno. Returns count on success.
- */
-static
-ssize_t lttng_test_filter_event_write(struct file *file, const char __user *user_buf,
-                   size_t count, loff_t *ppos)
-{
-       unsigned int nr_iter;
-       ssize_t written;
-       int ret;
-
-       /* Get the number of iterations */
-       ret = kstrtouint_from_user(user_buf, count, 10, &nr_iter);
-       if (ret) {
-               written = ret;
-               goto end;
-       }
-       /* Trace the event */
-       trace_test_event(nr_iter);
-       written = count;
-       *ppos += written;
-end:
-       return written;
-}
-
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
-static const struct proc_ops lttng_test_filter_event_proc_ops = {
-       .proc_write = lttng_test_filter_event_write,
-};
-#else
-static const struct file_operations lttng_test_filter_event_proc_ops = {
-       .write = lttng_test_filter_event_write,
-};
-#endif
-
-static
-int __init lttng_test_init(void)
-{
-       int ret = 0;
-
-       (void) wrapper_lttng_fixup_sig(THIS_MODULE);
-       wrapper_vmalloc_sync_mappings();
-       lttng_test_filter_event_dentry =
-                       proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE,
-                               S_IRUGO | S_IWUGO, NULL,
-                               &lttng_test_filter_event_proc_ops, NULL);
-       if (!lttng_test_filter_event_dentry) {
-               printk(KERN_ERR "Error creating LTTng test filter file\n");
-               ret = -ENOMEM;
-               goto error;
-       }
-       ret = __lttng_events_init__lttng_test();
-       if (ret)
-               goto error_events;
-       return ret;
-
-error_events:
-       remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
-error:
-       return ret;
-}
-
-module_init(lttng_test_init);
-
-static
-void __exit lttng_test_exit(void)
-{
-       __lttng_events_exit__lttng_test();
-       if (lttng_test_filter_event_dentry)
-               remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
-}
-
-module_exit(lttng_test_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
-MODULE_DESCRIPTION("LTTng Test");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
-       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-       LTTNG_MODULES_EXTRAVERSION);
This page took 0.035716 seconds and 4 git commands to generate.