perf tests: Use shebangs in the shell scripts
authorMichael Petlan <mpetlan@redhat.com>
Wed, 21 Nov 2018 21:39:18 +0000 (16:39 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 18 Dec 2018 15:21:44 +0000 (12:21 -0300)
Since the first line was used as a test identification, it needs to be
skipped by shell_test__description() function now.

Further notes from Hendrik:

It might be worth to note that adding the shebang is necessary to spot
them as scripts.

Using /bin/sh looks fine to.  Just briefly checked whether the scripts
contains some bash-specifics, which is not the case.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
LPU-Reference: 2127419430.57657104.1542836358464.JavaMail.zimbra@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/builtin-test.c
tools/perf/tests/shell/probe_vfs_getname.sh
tools/perf/tests/shell/record+probe_libc_inet_pton.sh
tools/perf/tests/shell/record+script_probe_vfs_getname.sh
tools/perf/tests/shell/trace+probe_vfs_getname.sh

index 12c09e0ece7105425f123bc8a81f4d61455e47ba..9852b5d624a5faa649ffcd7d1c0aec5901b0e617 100644 (file)
@@ -424,6 +424,9 @@ static const char *shell_test__description(char *description, size_t size,
        if (!fp)
                return NULL;
 
+       /* Skip shebang */
+       while (fgetc(fp) != '\n');
+
        description = fgets(description, size, fp);
        fclose(fp);
 
index 9b7635184dc20e6018027045996e53648c97c61a..46e076e3c53773ddb35965ad3834658ddaf722ac 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Add vfs_getname probe to get syscall args filenames
 #
 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
index cab7b0aea6eabbec7575db5bcf6a2cffbe93a762..61c9f8fc6fa1cc3d1bec05649525cd2540673b10 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 # probe libc's inet_pton & backtrace it with ping
 
 # Installs a probe on libc's inet_pton function, that will use uprobes,
index ba29535b8580a6caebfb339d4d81789b41e407ec..9b073e7fa88c86247046da9eef70be23f9ae31e6 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Use vfs_getname probe to get syscall args filenames
 
 # Uses the 'perf test shell' library to add probe:vfs_getname to the system
index 4ce276efe6b4c1855e904a30a2e9efcb6ed01a4e..50109f27ca07ca6abf4db21394c98edd2a0698b8 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Check open filename arg using perf trace + vfs_getname
 
 # Uses the 'perf test shell' library to add probe:vfs_getname to the system