summaryrefslogtreecommitdiffstats
path: root/tools/perf/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/tests')
-rw-r--r--tools/perf/tests/builtin-test.c37
-rw-r--r--tools/perf/tests/code-reading.c10
-rwxr-xr-xtools/perf/tests/shell/test_arm_coresight.sh2
-rw-r--r--tools/perf/tests/workloads/datasym.c16
4 files changed, 28 insertions, 37 deletions
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index d13ee7683..e05b370b1 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -274,11 +274,8 @@ static int finish_test(struct child_test *child_test, int width)
struct test_suite *t = child_test->test;
int i = child_test->test_num;
int subi = child_test->subtest;
- int out = child_test->process.out;
int err = child_test->process.err;
- bool out_done = out <= 0;
bool err_done = err <= 0;
- struct strbuf out_output = STRBUF_INIT;
struct strbuf err_output = STRBUF_INIT;
int ret;
@@ -290,11 +287,9 @@ static int finish_test(struct child_test *child_test, int width)
pr_info("%3d: %-*s:\n", i + 1, width, test_description(t, -1));
/*
- * Busy loop reading from the child's stdout and stderr that are set to
- * be non-blocking until EOF.
+ * Busy loop reading from the child's stdout/stderr that are set to be
+ * non-blocking until EOF.
*/
- if (!out_done)
- fcntl(out, F_SETFL, O_NONBLOCK);
if (!err_done)
fcntl(err, F_SETFL, O_NONBLOCK);
if (verbose > 1) {
@@ -303,11 +298,8 @@ static int finish_test(struct child_test *child_test, int width)
else
pr_info("%3d: %s:\n", i + 1, test_description(t, -1));
}
- while (!out_done || !err_done) {
- struct pollfd pfds[2] = {
- { .fd = out,
- .events = POLLIN | POLLERR | POLLHUP | POLLNVAL,
- },
+ while (!err_done) {
+ struct pollfd pfds[1] = {
{ .fd = err,
.events = POLLIN | POLLERR | POLLHUP | POLLNVAL,
},
@@ -317,21 +309,7 @@ static int finish_test(struct child_test *child_test, int width)
/* Poll to avoid excessive spinning, timeout set for 1000ms. */
poll(pfds, ARRAY_SIZE(pfds), /*timeout=*/1000);
- if (!out_done && pfds[0].revents) {
- errno = 0;
- len = read(out, buf, sizeof(buf) - 1);
-
- if (len <= 0) {
- out_done = errno != EAGAIN;
- } else {
- buf[len] = '\0';
- if (verbose > 1)
- fprintf(stdout, "%s", buf);
- else
- strbuf_addstr(&out_output, buf);
- }
- }
- if (!err_done && pfds[1].revents) {
+ if (!err_done && pfds[0].revents) {
errno = 0;
len = read(err, buf, sizeof(buf) - 1);
@@ -354,14 +332,10 @@ static int finish_test(struct child_test *child_test, int width)
pr_info("%3d.%1d: %s:\n", i + 1, subi + 1, test_description(t, subi));
else
pr_info("%3d: %s:\n", i + 1, test_description(t, -1));
- fprintf(stdout, "%s", out_output.buf);
fprintf(stderr, "%s", err_output.buf);
}
- strbuf_release(&out_output);
strbuf_release(&err_output);
print_test_result(t, i, subi, ret, width);
- if (out > 0)
- close(out);
if (err > 0)
close(err);
return 0;
@@ -394,6 +368,7 @@ static int start_test(struct test_suite *test, int i, int subi, struct child_tes
(*child)->process.no_stdout = 1;
(*child)->process.no_stderr = 1;
} else {
+ (*child)->process.stdout_to_stderr = 1;
(*child)->process.out = -1;
(*child)->process.err = -1;
}
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 7a3a7bbbe..29d2f3ee4 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -637,11 +637,11 @@ static int do_test_code_reading(bool try_kcore)
evlist__config(evlist, &opts, NULL);
- evsel = evlist__first(evlist);
-
- evsel->core.attr.comm = 1;
- evsel->core.attr.disabled = 1;
- evsel->core.attr.enable_on_exec = 0;
+ evlist__for_each_entry(evlist, evsel) {
+ evsel->core.attr.comm = 1;
+ evsel->core.attr.disabled = 1;
+ evsel->core.attr.enable_on_exec = 0;
+ }
ret = evlist__open(evlist);
if (ret < 0) {
diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
index 65dd85207..3302ea0b9 100755
--- a/tools/perf/tests/shell/test_arm_coresight.sh
+++ b/tools/perf/tests/shell/test_arm_coresight.sh
@@ -188,7 +188,7 @@ arm_cs_etm_snapshot_test() {
arm_cs_etm_basic_test() {
echo "Recording trace with '$*'"
- perf record -o ${perfdata} "$@" -- ls > /dev/null 2>&1
+ perf record -o ${perfdata} "$@" -m,8M -- ls > /dev/null 2>&1
perf_script_branch_samples ls &&
perf_report_branch_samples ls &&
diff --git a/tools/perf/tests/workloads/datasym.c b/tools/perf/tests/workloads/datasym.c
index ddd40bc63..8e08fc75a 100644
--- a/tools/perf/tests/workloads/datasym.c
+++ b/tools/perf/tests/workloads/datasym.c
@@ -16,6 +16,22 @@ static int datasym(int argc __maybe_unused, const char **argv __maybe_unused)
{
for (;;) {
buf1.data1++;
+ if (buf1.data1 == 123) {
+ /*
+ * Add some 'noise' in the loop to work around errata
+ * 1694299 on Arm N1.
+ *
+ * Bias exists in SPE sampling which can cause the load
+ * and store instructions to be skipped entirely. This
+ * comes and goes randomly depending on the offset the
+ * linker places the datasym loop at in the Perf binary.
+ * With an extra branch in the middle of the loop that
+ * isn't always taken, the instruction stream is no
+ * longer a continuous repeating pattern that interacts
+ * badly with the bias.
+ */
+ buf1.data1++;
+ }
buf1.data2 += buf1.data1;
}
return 0;