add missing tests
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 May 2006 13:57:35 +0000 (13:57 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 May 2006 13:57:35 +0000 (13:57 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1869 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/ltt-facility-id-tests.h [new file with mode: 0644]
tests/kernel/ltt-facility-loader-tests.c [new file with mode: 0644]
tests/kernel/ltt-facility-loader-tests.h [new file with mode: 0644]
tests/kernel/ltt-facility-loader-tests.mod.c [new file with mode: 0644]
tests/kernel/ltt-facility-tests.h [new file with mode: 0644]
tests/kernel/test-cmpxchg.c
tests/kernel/test-printk-effect.c [new file with mode: 0644]

index 3ebe0c0f0f2a5f59e7778b27ecc974a8ba6df4e8..b34a39900fdb1438b7900ae151e9d816b763a8e3 100644 (file)
@@ -1,11 +1,11 @@
 ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_LTT),)
-       #obj-m += ltt-facility-loader-tests.o
-       #obj-m += test-time-probe.o 
-       #obj-m += test-instrument-size-small.o
-       #obj-m += test-instrument-size-med.o
-       #obj-m += test-instrument-size-big.o
-       #obj-m += test-printk-effect.o
+       obj-m += ltt-facility-loader-tests.o
+       obj-m += test-time-probe.o 
+       obj-m += test-instrument-size-small.o
+       obj-m += test-instrument-size-med.o
+       obj-m += test-instrument-size-big.o
+       obj-m += test-printk-effect.o
 endif
        obj-m += test-cmpxchg.o
 
diff --git a/tests/kernel/ltt-facility-id-tests.h b/tests/kernel/ltt-facility-id-tests.h
new file mode 100644 (file)
index 0000000..ba10744
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _LTT_FACILITY_ID_TESTS_H_
+#define _LTT_FACILITY_ID_TESTS_H_
+
+#ifdef CONFIG_LTT
+#include <linux/ltt-facilities.h>
+
+/****  facility handle  ****/
+
+extern ltt_facility_t ltt_facility_tests_2F06D8DB;
+extern ltt_facility_t ltt_facility_tests;
+
+
+/****  event index  ****/
+
+enum tests_event {
+       event_tests_write_4bytes,
+       event_tests_write_string,
+       event_tests_write_struct,
+       facility_tests_num_events
+};
+
+#endif //CONFIG_LTT
+#endif //_LTT_FACILITY_ID_TESTS_H_
diff --git a/tests/kernel/ltt-facility-loader-tests.c b/tests/kernel/ltt-facility-loader-tests.c
new file mode 100644 (file)
index 0000000..3a232c7
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * ltt-facility-loader-tests.c
+ *
+ * (C) Copyright  2005 - 
+ *          Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
+ *
+ * Contains the LTT facility loader.
+ *
+ */
+
+
+#include <linux/ltt-facilities.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/config.h>
+#include "ltt-facility-loader-tests.h"
+
+
+#ifdef CONFIG_LTT
+
+EXPORT_SYMBOL(LTT_FACILITY_SYMBOL);
+EXPORT_SYMBOL(LTT_FACILITY_CHECKSUM_SYMBOL);
+
+static const char ltt_facility_name[] = LTT_FACILITY_NAME;
+
+#define SYMBOL_STRING(sym) #sym
+
+static struct ltt_facility facility = {
+       .name = ltt_facility_name,
+       .num_events = LTT_FACILITY_NUM_EVENTS,
+       .checksum = LTT_FACILITY_CHECKSUM,
+       .symbol = SYMBOL_STRING(LTT_FACILITY_SYMBOL),
+};
+
+static int __init facility_init(void)
+{
+       printk(KERN_INFO "LTT : ltt-facility-tests init in kernel\n");
+
+       LTT_FACILITY_SYMBOL = ltt_facility_kernel_register(&facility);
+       LTT_FACILITY_CHECKSUM_SYMBOL = LTT_FACILITY_SYMBOL;
+       
+       return LTT_FACILITY_SYMBOL;
+}
+
+#ifndef MODULE
+__initcall(facility_init);
+#else
+module_init(facility_init);
+static void __exit facility_exit(void)
+{
+       int err;
+
+       err = ltt_facility_unregister(LTT_FACILITY_SYMBOL);
+       if(err != 0)
+               printk(KERN_ERR "LTT : Error in unregistering facility.\n");
+
+}
+module_exit(facility_exit)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit Facility");
+
+#endif //MODULE
+
+#endif //CONFIG_LTT
diff --git a/tests/kernel/ltt-facility-loader-tests.h b/tests/kernel/ltt-facility-loader-tests.h
new file mode 100644 (file)
index 0000000..bf16148
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef _LTT_FACILITY_LOADER_TESTS_H_
+#define _LTT_FACILITY_LOADER_TESTS_H_
+
+#ifdef CONFIG_LTT
+
+#include <linux/ltt-facilities.h>
+#include "ltt-facility-id-tests.h"
+
+ltt_facility_t ltt_facility_tests;
+ltt_facility_t ltt_facility_tests_2F06D8DB;
+
+#define LTT_FACILITY_SYMBOL                                                    ltt_facility_tests
+#define LTT_FACILITY_CHECKSUM_SYMBOL           ltt_facility_tests_2F06D8DB
+#define LTT_FACILITY_CHECKSUM                                          0x2F06D8DB
+#define LTT_FACILITY_NAME                                                              "tests"
+#define LTT_FACILITY_NUM_EVENTS                                        facility_tests_num_events
+
+#endif //CONFIG_LTT
+
+#endif //_LTT_FACILITY_LOADER_TESTS_H_
diff --git a/tests/kernel/ltt-facility-loader-tests.mod.c b/tests/kernel/ltt-facility-loader-tests.mod.c
new file mode 100644 (file)
index 0000000..e5bbf0e
--- /dev/null
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=";
+
diff --git a/tests/kernel/ltt-facility-tests.h b/tests/kernel/ltt-facility-tests.h
new file mode 100644 (file)
index 0000000..a0aa42e
--- /dev/null
@@ -0,0 +1,551 @@
+#ifndef _LTT_FACILITY_TESTS_H_
+#define _LTT_FACILITY_TESTS_H_
+
+#include <linux/types.h>
+#include "ltt-facility-id-tests.h"
+#include <linux/ltt-core.h>
+
+/* Named types */
+
+/* Event write_4bytes structures */
+
+/* Event write_4bytes logging function */
+static inline void trace_tests_write_4bytes(
+               int lttng_param_data)
+#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_channel_struct *channel;
+       struct ltt_trace_struct *trace;
+       struct rchan_buf *relayfs_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+       u64 tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(ltt_traces.num_active_traces == 0) return;
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_data;
+       align = sizeof(int);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(int);
+
+       reserve_size = *to_base + *to + *len;
+       preempt_disable();
+       ltt_nesting[smp_processor_id()]++;
+       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
+                                               event_tests_write_4bytes);
+
+       list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
+               if(!trace->active) continue;
+
+               channel = ltt_get_channel_from_index(trace, index);
+               relayfs_buf = channel->rchan->buf[smp_processor_id()];
+
+               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, relayfs_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) continue; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, channel, buffer,
+                       ltt_facility_tests_2F06D8DB, event_tests_write_4bytes,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = &lttng_param_data;
+               align = sizeof(int);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(int);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(relayfs_buf, buffer, slot_size);
+
+       }
+
+       ltt_nesting[smp_processor_id()]--;
+       preempt_enable_no_resched();
+}
+#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+
+
+/* Event write_string structures */
+static inline void lttng_write_string_tests_write_string_data(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+
+/* Event write_string logging function */
+static inline void trace_tests_write_string(
+               const char * lttng_param_data)
+#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_channel_struct *channel;
+       struct ltt_trace_struct *trace;
+       struct rchan_buf *relayfs_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const void *real_from;
+       const void **from = &real_from;
+       u64 tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(ltt_traces.num_active_traces == 0) return;
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_data;
+       lttng_write_string_tests_write_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+       reserve_size = *to_base + *to + *len;
+       preempt_disable();
+       ltt_nesting[smp_processor_id()]++;
+       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
+                                               event_tests_write_string);
+
+       list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
+               if(!trace->active) continue;
+
+               channel = ltt_get_channel_from_index(trace, index);
+               relayfs_buf = channel->rchan->buf[smp_processor_id()];
+
+               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, relayfs_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) continue; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, channel, buffer,
+                       ltt_facility_tests_2F06D8DB, event_tests_write_string,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = lttng_param_data;
+               lttng_write_string_tests_write_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(relayfs_buf, buffer, slot_size);
+
+       }
+
+       ltt_nesting[smp_processor_id()]--;
+       preempt_enable_no_resched();
+}
+#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+
+
+/* Event write_struct structures */
+typedef struct lttng_sequence_tests_write_struct_data2_data5 lttng_sequence_tests_write_struct_data2_data5;
+struct lttng_sequence_tests_write_struct_data2_data5 {
+       unsigned int len;
+       const int64_t *array;
+};
+
+struct lttng_tests_write_struct_data2 {
+       const char * data3;
+       int data4;
+       lttng_sequence_tests_write_struct_data2_data5 data5;
+       int data6;
+} LTT_ALIGN;
+
+static inline size_t lttng_get_alignment_sequence_tests_write_struct_data2_data5(
+               lttng_sequence_tests_write_struct_data2_data5 *obj)
+{
+       size_t align=0, localign;
+       localign = sizeof(unsigned int);
+       align = max(align, localign);
+
+       localign = sizeof(int64_t);
+       align = max(align, localign);
+
+       return align;
+}
+
+static inline size_t lttng_get_alignment_struct_tests_write_struct_data2(
+               struct lttng_tests_write_struct_data2 *obj)
+{
+       size_t align=0, localign;
+       localign = sizeof(char);
+       align = max(align, localign);
+
+       localign = sizeof(int);
+       align = max(align, localign);
+
+       localign = lttng_get_alignment_sequence_tests_write_struct_data2_data5(&obj->data5);
+       align = max(align, localign);
+
+       localign = sizeof(int);
+       align = max(align, localign);
+
+       return align;
+}
+
+static inline void lttng_write_string_tests_write_struct_data2_data3(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+static inline void lttng_write_sequence_tests_write_struct_data2_data5(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               lttng_sequence_tests_write_struct_data2_data5 *obj)
+{
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = lttng_get_alignment_sequence_tests_write_struct_data2_data5(obj);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       /* Copy members */
+       align = sizeof(unsigned int);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(unsigned int);
+
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, &obj->len, *len);
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(int64_t);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(int64_t);
+
+       *len = obj->len * (*len);
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj->array, *len);
+       *to += *len;
+       *len = 0;
+
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C sequence */
+       *from = obj+1;
+}
+
+static inline void lttng_write_struct_tests_write_struct_data2(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               struct lttng_tests_write_struct_data2 *obj)
+{
+       size_t align;
+
+       align = lttng_get_alignment_struct_tests_write_struct_data2(obj);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       lttng_write_string_tests_write_struct_data2_data3(buffer, to_base, to, from, len, obj->data3);
+
+       align = sizeof(int);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(int);
+
+       lttng_write_sequence_tests_write_struct_data2_data5(buffer, to_base, to, from, len, &obj->data5);
+       align = sizeof(int);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(int);
+
+}
+
+
+/* Event write_struct logging function */
+static inline void trace_tests_write_struct(
+               int lttng_param_data1,
+               struct lttng_tests_write_struct_data2 * lttng_param_data2)
+#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_channel_struct *channel;
+       struct ltt_trace_struct *trace;
+       struct rchan_buf *relayfs_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+       u64 tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(ltt_traces.num_active_traces == 0) return;
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_data1;
+       align = sizeof(int);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(int);
+
+       *from = lttng_param_data2;
+       lttng_write_struct_tests_write_struct_data2(buffer, to_base, to, from, len, lttng_param_data2);
+       reserve_size = *to_base + *to + *len;
+       preempt_disable();
+       ltt_nesting[smp_processor_id()]++;
+       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
+                                               event_tests_write_struct);
+
+       list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
+               if(!trace->active) continue;
+
+               channel = ltt_get_channel_from_index(trace, index);
+               relayfs_buf = channel->rchan->buf[smp_processor_id()];
+
+               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, relayfs_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) continue; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, channel, buffer,
+                       ltt_facility_tests_2F06D8DB, event_tests_write_struct,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = &lttng_param_data1;
+               align = sizeof(int);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(int);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = lttng_param_data2;
+               lttng_write_struct_tests_write_struct_data2(buffer, to_base, to, from, len, lttng_param_data2);
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(relayfs_buf, buffer, slot_size);
+
+       }
+
+       ltt_nesting[smp_processor_id()]--;
+       preempt_enable_no_resched();
+}
+#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
+
+
+#endif //_LTT_FACILITY_TESTS_H_
index da7f515a5bbc00332131e30ceb21be932ab270f6..69a25334219fc9ef8ec275b3b266212ca740b3db 100644 (file)
@@ -12,7 +12,6 @@
 
 #define NR_LOOPS 20000
 
-
 volatile int test_val = 100;
 
 
diff --git a/tests/kernel/test-printk-effect.c b/tests/kernel/test-printk-effect.c
new file mode 100644 (file)
index 0000000..a9429de
--- /dev/null
@@ -0,0 +1,38 @@
+/* test-time-probe.c
+ *
+ * Test printk effect on timer interrupt.
+ */
+
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/ltt-core.h>
+
+#define NR_LOOPS 20000
+
+static int ltt_test_init(void)
+{
+       unsigned int i;
+
+       printk(KERN_ALERT "test init\n");
+       
+       for(i=0; i<NR_LOOPS; i++) {
+               printk(KERN_ALERT "Flooding the console\n");
+       }
+       printk(KERN_ALERT "test end\n");
+       
+       return -EAGAIN; /* Fail will directly unload the module */
+}
+
+static void ltt_test_exit(void)
+{
+       printk(KERN_ALERT "test exit\n");
+}
+
+module_init(ltt_test_init)
+module_exit(ltt_test_exit)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit Test");
+
This page took 0.032507 seconds and 4 git commands to generate.