linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: intel_pstate: Fix a condition which does not notify user that root permission is useful
@ 2018-05-09 17:38 Jeffrin Jose T
  2018-05-09 18:24 ` Daniel Díaz
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffrin Jose T @ 2018-05-09 17:38 UTC (permalink / raw)
  To: shuah, kstewart, daniel.diaz, pombredanne, gregkh, thomas
  Cc: linux-kselftest, linux-kernel, Jeffrin Jose T, Jeffrin Jose T

aperf program uses /dev/cpu which is normally a root only
access area. so in that case to successfully run thet test,
root permissions are required.This patch is in the file run.sh.

Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
---
 tools/testing/selftests/intel_pstate/run.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
index 23a2e4e9880e..05d35392dcfd 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -31,6 +31,14 @@
 
 EVALUATE_ONLY=0
 
+uid=$(id -u)
+if [ $uid -ne 0 ]; then
+    echo     "-----------------------"
+    echo $msg please run this as root >&2
+    echo     "-----------------------"
+    exit 0
+fi
+
 if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then
 	echo "$0 # Skipped: Test can only run on x86 architectures."
 	exit 0
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: intel_pstate: Fix a condition which does not notify user that root permission is useful
  2018-05-09 17:38 [PATCH] selftests: intel_pstate: Fix a condition which does not notify user that root permission is useful Jeffrin Jose T
@ 2018-05-09 18:24 ` Daniel Díaz
  2018-05-09 18:44   ` Jeffrin Thalakkottoor
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Díaz @ 2018-05-09 18:24 UTC (permalink / raw)
  To: Jeffrin Jose T, shuah, kstewart, pombredanne, gregkh, thomas
  Cc: linux-kselftest, linux-kernel, Jeffrin Jose T

Hello!


On 05/09/2018 12:38 PM, Jeffrin Jose T wrote:
> aperf program uses /dev/cpu which is normally a root only
> access area. so in that case to successfully run thet test,
> root permissions are required.This patch is in the file run.sh.
> 
> Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
> ---
>  tools/testing/selftests/intel_pstate/run.sh | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
> index 23a2e4e9880e..05d35392dcfd 100755
> --- a/tools/testing/selftests/intel_pstate/run.sh
> +++ b/tools/testing/selftests/intel_pstate/run.sh
> @@ -31,6 +31,14 @@
>  
>  EVALUATE_ONLY=0
>  
> +uid=$(id -u)
> +if [ $uid -ne 0 ]; then
> +    echo     "-----------------------"
> +    echo $msg please run this as root >&2
> +    echo     "-----------------------"
> +    exit 0
> +fi
> +

Other tests simply use $UID. See:
  cpufreq/main.sh
  cpu-hotplug/cpu-on-off-test.sh
  efivarfs/efivarfs.sh
  gpio/gpio-mockup.sh
  memory-hotplug/mem-on-off-test.sh

This doesn't take into account the conditions for EVALUATE_ONLY: When
it's set non-zero, neither aperf nor cpupower run at all.

While this is under review, you might want to base your change on
Shuah's patch for skipping:

https://lists.linaro.org/pipermail/linux-kselftest-mirror/2018-May/001074.html


>  if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then
>  	echo "$0 # Skipped: Test can only run on x86 architectures."
>  	exit 0

I'd leave this check at the forefront, as this "hurdle" is
insurmountable in other architectures, whereas becoming root is attainable.

Thanks and greetings!

Daniel Díaz
daniel.diaz@linaro.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: intel_pstate: Fix a condition which does not notify user that root permission is useful
  2018-05-09 18:24 ` Daniel Díaz
@ 2018-05-09 18:44   ` Jeffrin Thalakkottoor
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrin Thalakkottoor @ 2018-05-09 18:44 UTC (permalink / raw)
  To: Daniel Díaz
  Cc: Jeffrin Jose T, Shuah Khan, Kate Stewart, Philippe Ombredanne,
	gregkh, thomas, linux-kselftest, lkml

thanks. i will work on...

On Wed, May 9, 2018 at 11:54 PM, Daniel Díaz <daniel.diaz@linaro.org> wrote:
> Hello!
>
>
> On 05/09/2018 12:38 PM, Jeffrin Jose T wrote:
>> aperf program uses /dev/cpu which is normally a root only
>> access area. so in that case to successfully run thet test,
>> root permissions are required.This patch is in the file run.sh.
>>
>> Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
>> ---
>>  tools/testing/selftests/intel_pstate/run.sh | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
>> index 23a2e4e9880e..05d35392dcfd 100755
>> --- a/tools/testing/selftests/intel_pstate/run.sh
>> +++ b/tools/testing/selftests/intel_pstate/run.sh
>> @@ -31,6 +31,14 @@
>>
>>  EVALUATE_ONLY=0
>>
>> +uid=$(id -u)
>> +if [ $uid -ne 0 ]; then
>> +    echo     "-----------------------"
>> +    echo $msg please run this as root >&2
>> +    echo     "-----------------------"
>> +    exit 0
>> +fi
>> +
>
> Other tests simply use $UID. See:
>   cpufreq/main.sh
>   cpu-hotplug/cpu-on-off-test.sh
>   efivarfs/efivarfs.sh
>   gpio/gpio-mockup.sh
>   memory-hotplug/mem-on-off-test.sh
>
> This doesn't take into account the conditions for EVALUATE_ONLY: When
> it's set non-zero, neither aperf nor cpupower run at all.
>
> While this is under review, you might want to base your change on
> Shuah's patch for skipping:
>
> https://lists.linaro.org/pipermail/linux-kselftest-mirror/2018-May/001074.html
>
>
>>  if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then
>>       echo "$0 # Skipped: Test can only run on x86 architectures."
>>       exit 0
>
> I'd leave this check at the forefront, as this "hurdle" is
> insurmountable in other architectures, whereas becoming root is attainable.
>
> Thanks and greetings!
>
> Daniel Díaz
> daniel.diaz@linaro.org



-- 
software engineer
rajagiri school of engineering and technology

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-09 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 17:38 [PATCH] selftests: intel_pstate: Fix a condition which does not notify user that root permission is useful Jeffrin Jose T
2018-05-09 18:24 ` Daniel Díaz
2018-05-09 18:44   ` Jeffrin Thalakkottoor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).