Skip to contentSkip to conversation

sched_getattr/sched_getattr01: Use macro definitions to replace numbers

PATCH Superseded Cui Bixuan 2 participants 5 messages Oct 20, 2015 – Oct 28, 2015

lore
Share & tools
lore

Cui Bixuan

author
#0 lore raw

PATCH 1/1 sched_getattr/sched_getattr01: Use macro definitions to replace numbers

Use 'RUNTIME_VAL','PERIOD_VAL' and 'DEADLINE_VAL' to set attr

---
 .../syscalls/sched_getattr/sched_getattr01.c       |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sched_getattr/sched_getattr01.c +3 -3
index 267b8b1..bf6c5b6 100644
@@ -38,9 +38,9 @@ void *run_deadline(void *data LTP_ATTRIBUTE_UNUSED)
 
 	/* This creates a 10ms/30ms reservation */
 	attr.sched_policy = SCHED_DEADLINE;
-	attr.sched_runtime = 10 * 1000 * 1000;
-	attr.sched_period = 30 * 1000 * 1000;
-	attr.sched_deadline = 30 * 1000 * 1000;
+	attr.sched_runtime = RUNTIME_VAL;
+	attr.sched_period = PERIOD_VAL;
+	attr.sched_deadline = DEADLINE_VAL;
 
 	ret = sched_setattr(0, &attr, flags);
 	if (ret < 0)
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 1/1 sched_getattr/sched_getattr01: Use macro definitions to replace numbers

Hi!

Quoted 12 lines

Use 'RUNTIME_VAL','PERIOD_VAL' and 'DEADLINE_VAL' to set attr

---
 .../syscalls/sched_getattr/sched_getattr01.c       |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sched_getattr/sched_getattr01.c +0 -0
index 267b8b1..bf6c5b6 100644

testcases/kernel/syscalls/sched_getattr/sched_getattr01.c void *run_deadline(void *data LTP_ATTRIBUTE_UNUSED) · line 43

Quoted 9 lines
testcases/kernel/syscalls/sched_getattr/sched_getattr01.c +3 -3
@@ -38,9 +38,9 @@ void *run_deadline(void *data LTP_ATTRIBUTE_UNUSED)
 
 	/* This creates a 10ms/30ms reservation */
 	attr.sched_policy = SCHED_DEADLINE;
-	attr.sched_runtime = 10 * 1000 * 1000;
-	attr.sched_period = 30 * 1000 * 1000;
-	attr.sched_deadline = 30 * 1000 * 1000;
+	attr.sched_runtime = RUNTIME_VAL;
+	attr.sched_period = PERIOD_VAL;
+	attr.sched_deadline = DEADLINE_VAL;

Looking at the test it also misses GPL header in a comment. Can you please send a patch that adds it as well?
(sorry for not catching that earlier)

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#2 lore raw

PATCH v2 1/1 sched_getattr/sched_getattr01: Use macro definitions to replace numbers

Use 'RUNTIME_VAL','PERIOD_VAL' and 'DEADLINE_VAL' to set attr

---
V2:
* Add GPL header in testcase;

 .../syscalls/sched_getattr/sched_getattr01.c       |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sched_getattr/sched_getattr01.c +16 -3
index 267b8b1..62faeca 100644
@@ -1,3 +1,16 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd., 2015
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <stdio.h>
@@ -38,9 +51,9 @@ void *run_deadline(void *data LTP_ATTRIBUTE_UNUSED)
 
 	/* This creates a 10ms/30ms reservation */
 	attr.sched_policy = SCHED_DEADLINE;
-	attr.sched_runtime = 10 * 1000 * 1000;
-	attr.sched_period = 30 * 1000 * 1000;
-	attr.sched_deadline = 30 * 1000 * 1000;
+	attr.sched_runtime = RUNTIME_VAL;
+	attr.sched_period = PERIOD_VAL;
+	attr.sched_deadline = DEADLINE_VAL;
 
 	ret = sched_setattr(0, &attr, flags);
 	if (ret < 0)
Signature · 1 line
1.6.0.2
#3 lore raw

PATCH v2 1/1 sched_getattr/sched_getattr01: Use macro definitions to replace numbers

Hi!
Pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#4 lore raw

PATCH v2 1/1 sched_getattr/sched_getattr01: Use macro definitions to replace numbers

Quoted 2 lines · Cyril Hrubis

Hi!
Pushed, thanks.

Thanks

Quoted 1 line