[PATCH libevdev 4/4] test: skip tests when we're not root

Benjamin Tissoires benjamin.tissoires at gmail.com
Mon Feb 26 09:31:00 UTC 2018


On Mon, Feb 26, 2018 at 8:13 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---

For the series:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

Cheers,
Benjamin

>  test/test-kernel.c | 5 +++++
>  test/test-main.c   | 5 +++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/test/test-kernel.c b/test/test-kernel.c
> index 6fba605..411306a 100644
> --- a/test/test-kernel.c
> +++ b/test/test-kernel.c
> @@ -167,6 +167,11 @@ int main(int argc, char **argv)
>         TCase *tc;
>         int failed;
>
> +       if (getuid() != 0) {
> +               fprintf(stderr, "This test needs to run as root\n");
> +               return 77;
> +       }
> +
>         s = suite_create("kernel tests");
>
>         tc = tcase_create("EVIOCREVOKE");
> diff --git a/test/test-main.c b/test/test-main.c
> index d80806f..9a2bf94 100644
> --- a/test/test-main.c
> +++ b/test/test-main.c
> @@ -73,6 +73,11 @@ int main(void)
>         const struct rlimit corelimit = {0, 0};
>         int failed;
>
> +       if (getuid() != 0) {
> +               fprintf(stderr, "This test needs to run as root\n");
> +               return 77;
> +       }
> +
>         if (is_debugger_attached())
>                 setenv("CK_FORK", "no", 0);
>
> --
> 2.14.3
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list