All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: tangchen <tangchen@cn.fujitsu.com>
Cc: "ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [POSIX] [PATCH] sched_setscheduler/17-5.c: Add the missing scheduling policies.
Date: Thu, 18 Aug 2011 13:28:47 +0200	[thread overview]
Message-ID: <20110818112847.GB19491@saboteur.suse.cz> (raw)
In-Reply-To: <4E151B53.4050207@cn.fujitsu.com>

Hi!
> On linux, I found the scheduling policies are defined as follow:
> 
> in /usr/include/bits/sched.h
> 
> /* Scheduling algorithms.  */
> #define SCHED_OTHER             0
> #define SCHED_FIFO              1
> #define SCHED_RR                2
> #ifdef __USE_GNU
> # define SCHED_BATCH            3
> # define SCHED_IDLE             5
> 
> # define SCHED_RESET_ON_FORK    0x40000000
> #endif
> 
> So besides SCHED_OTHER, SCHED_FIFO and SCHED_RR, there are another 
> two policies, SCHED_BATCH and SCHED_IDLE. And 3 is a valid value 
> for the scheduling policy, which causes the test returns UNSOLVED 
> on linux system.
>  
> Here is the patch, please comment!
> Thanks.:)
> 
> 
> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
> ---
>  .../interfaces/sched_setscheduler/17-5.c           |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
> index b4f90b3..652db27 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
> @@ -17,6 +17,11 @@
>   *   2. Call sched_setscheduler with invalid args.
>   *   3. Check that the policy and priority have not changed.
>   */
> +
> +#ifdef __linux__
> +#define _GNU_SOURCE
> +#endif
> +
>  #include <sched.h>
>  #include <stdio.h>
>  #include <errno.h>
> @@ -31,6 +36,10 @@ int main() {
>  	invalid_policy = 0;
>  	/* Linux does not treat minus value as invalid for policy */
>  	while (invalid_policy == SCHED_OTHER ||
> +#ifdef _GNU_SOURCE
> +		invalid_policy == SCHED_BATCH ||
> +		invalid_policy == SCHED_IDLE ||
> +#endif
>  		invalid_policy == SCHED_FIFO ||
>  		invalid_policy == SCHED_RR)
>  	invalid_policy++;
> @@ -78,4 +87,4 @@ int main() {
>  		printf("The policy has changed\n");
>  	}
>  	return PTS_FAIL;
> -}
> \ No newline at end of file
> +}

Meanwhile we changed the invalid policy to INT_MAX, which seems to work
fine. Thanks anyway.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

           reply	other threads:[~2011-08-18 11:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4E151B53.4050207@cn.fujitsu.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110818112847.GB19491@saboteur.suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=tangchen@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.