Re: [RFC PATCH v3 1/4] ftracetest: Initial commit for ftracetest

From: Steven Rostedt
Date: Tue Sep 16 2014 - 18:21:19 EST



> diff --git a/tools/testing/ftrace/README b/tools/testing/ftrace/README
> new file mode 100644
> index 0000000..5d5de16
> --- /dev/null
> +++ b/tools/testing/ftrace/README
> @@ -0,0 +1,45 @@
> +Linux Ftrace Testcases
> +
> +This is a collection of testcases for ftrace tracing feature in the Linux
> +kernel. Since ftrace exports interfaces via the debugfs, we just need
> +shell scripts for testing. Feel free to add new test cases.
> +
> +Running the ftrace testcases
> +============================
> +
> +At first, you need to be the root user to run this script.
> +To run all testcases:
> +
> + $ sudo ./ftracetest
> +
> +To run specific testcases:
> +
> + # ./ftracetest test.d/basic3.tc
> +
> +Or you can also run testcases under given directory:
> +
> + # ./ftracetest test.d/kprobe/
> +
> +Contributing new testcases
> +==========================
> +
> +Copy test.d/template to your testcase (whose filename must has *.tc extension)

"whose filename must have *.tc extension"

> +and rewrite test description line.

"and rewrite the test description line"

> +
> + * The working directory of the script is <debugfs>/tracing/.
> +
> + * Take care about the side effect, because that is run with root privilege.

"Take care with side effects as the tests are run with root privilege"

> +
> + * Don't take too long. It's a kind of unit test.

"The tests should not run for a long period of time. These are to be
unit tests"

We should probably specify what the time should be. Is 20 minutes too
long?


> +
> + * You can add a directory for your testcases under test.d/ if needed.
> +
> + * The test cases should run on dash (busybox shell) for testing on
> + minimal cross-build environments.
> +
> +TODO
> +====
> +
> + * Fancy colored output :)
> +
> + * Integrate with selftest?
> diff --git a/tools/testing/ftrace/ftracetest b/tools/testing/ftrace/ftracetest
> new file mode 100755
> index 0000000..8d92e74
> --- /dev/null
> +++ b/tools/testing/ftrace/ftracetest
> @@ -0,0 +1,152 @@
> +#!/bin/sh
> +# ftracetest - Ftrace test shell scripts
> +# Written by Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>

Maybe add your copyright here, with year?

Also, we should probably state that this is under the GPL v2?

-- Steve

> +
> +usage() { # errno [message]
> +[ "$2" ] && echo $2
> +echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
> +echo " Options:"
> +echo " -h|--help Show help message"
> +echo " -k|--keep Keep passed test logs"
> +echo " -d|--debug Debug mode (trace all shell commands)"
> +exit $1
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/