Skip to contentSkip to conversation

perf tools: replace assignment with comparison on assert check

PATCH In review Colin King 3 participants 3 messages Apr 23, 2016 – Apr 27, 2016 perf events

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 perf tools: replace assignment with comparison on assert check

From: Colin Ian King <[email protected]>

The current assert check is checking an assignment, which will always be true. Instead, the assert should be checking if scale is equal to 0.122

---
 tools/perf/tests/event_update.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/event_update.c +1 -1
index 012eab5..63ecf21 100644
@@ -30,7 +30,7 @@ static int process_event_scale(struct perf_tool *tool __maybe_unused,
 
 	TEST_ASSERT_VAL("wrong id", ev->id == 123);
 	TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__SCALE);
-	TEST_ASSERT_VAL("wrong scale", ev_data->scale = 0.123);
+	TEST_ASSERT_VAL("wrong scale", ev_data->scale == 0.123);
 	return 0;
 }
 
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Sat, 23 Apr 2016 14:45:54 +0100 Colin King <[email protected]> wrote:

From: Colin Ian King <[email protected]>

The current assert check is checking an assignment, which will always be true. Instead, the assert should be checking if scale is equal to 0.122

Looks good to me.

Quoted 21 lines
---
 tools/perf/tests/event_update.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/event_update.c +1 -1
index 012eab5..63ecf21 100644
@@ -30,7 +30,7 @@ static int process_event_scale(struct perf_tool *tool __maybe_unused,
 
 	TEST_ASSERT_VAL("wrong id", ev->id == 123);
 	TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__SCALE);
-	TEST_ASSERT_VAL("wrong scale", ev_data->scale = 0.123);
+	TEST_ASSERT_VAL("wrong scale", ev_data->scale == 0.123);
 	return 0;
 }
 
Signature · 1 line
2.7.4
Signature · 1 line
Masami Hiramatsu <[email protected]>
#2 lore raw

[tip:perf/core] perf tests: Replace assignment with comparison on assert check

In reply to Colin King
perf tests: Replace assignment with comparison on assert check
Commit-ID:  8daef508b0a144970e5cbc587525c351663fec63
Gitweb:     http://git.kernel.org/tip/8daef508b0a144970e5cbc587525c351663fec63
Author:     Colin Ian King <[email protected]>
AuthorDate: Sat, 23 Apr 2016 14:45:54 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 25 Apr 2016 20:24:26 -0300

perf tests: Replace assignment with comparison on assert check

The current assert check is checking an assignment, which will always be true. Instead, the assert should be checking if scale is equal to 0.122

---
 tools/perf/tests/event_update.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/event_update.c +1 -1
index 012eab5..63ecf21 100644
@@ -30,7 +30,7 @@ static int process_event_scale(struct perf_tool *tool __maybe_unused,
 
 	TEST_ASSERT_VAL("wrong id", ev->id == 123);
 	TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__SCALE);
-	TEST_ASSERT_VAL("wrong scale", ev_data->scale = 0.123);
+	TEST_ASSERT_VAL("wrong scale", ev_data->scale == 0.123);
 	return 0;
 }