12c28215423293e443469a07ae7011135d058b671Garrett Cooper/*
20dc076565f772bb1953209fb69ea150b494aaa40robbiew *  This program is free software; you can redistribute it and/or modify
30dc076565f772bb1953209fb69ea150b494aaa40robbiew *  it under the terms of the GNU General Public License version 2.
40dc076565f772bb1953209fb69ea150b494aaa40robbiew *
50dc076565f772bb1953209fb69ea150b494aaa40robbiew *  This program is distributed in the hope that it will be useful,
60dc076565f772bb1953209fb69ea150b494aaa40robbiew *  but WITHOUT ANY WARRANTY; without even the implied warranty of
70dc076565f772bb1953209fb69ea150b494aaa40robbiew *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80dc076565f772bb1953209fb69ea150b494aaa40robbiew *  GNU General Public License for more details.
90dc076565f772bb1953209fb69ea150b494aaa40robbiew *
100dc076565f772bb1953209fb69ea150b494aaa40robbiew *
110dc076565f772bb1953209fb69ea150b494aaa40robbiew * Test that sched_get_priority_min() returns -1 on failure
120dc076565f772bb1953209fb69ea150b494aaa40robbiew */
130dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdio.h>
140dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <sched.h>
150dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <errno.h>
160dc076565f772bb1953209fb69ea150b494aaa40robbiew#include "posixtest.h"
170dc076565f772bb1953209fb69ea150b494aaa40robbiew
184ca2bbdcd3003f3c8df4e6129e9c7b2bd1514f87Cyril Hrubisint main(void)
192c28215423293e443469a07ae7011135d058b671Garrett Cooper{
200dc076565f772bb1953209fb69ea150b494aaa40robbiew	int result = -1;
212c28215423293e443469a07ae7011135d058b671Garrett Cooper
220dc076565f772bb1953209fb69ea150b494aaa40robbiew	result = sched_get_priority_min(-1);
232c28215423293e443469a07ae7011135d058b671Garrett Cooper
248fb1cdb0538640f295691929650408688537fb7fGarrett Cooper	if (result == -1 && errno == EINVAL) {
250dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("Test PASSED\n");
260dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_PASS;
270dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
280dc076565f772bb1953209fb69ea150b494aaa40robbiew
290dc076565f772bb1953209fb69ea150b494aaa40robbiew	if (result != -1) {
300dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("did not returned -1.\n");
310dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_FAIL;
320dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
330dc076565f772bb1953209fb69ea150b494aaa40robbiew
340dc076565f772bb1953209fb69ea150b494aaa40robbiew	if (errno != EINVAL) {
350dc076565f772bb1953209fb69ea150b494aaa40robbiew		perror("error is not EINVAL");
360dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_FAIL;
370dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
382c28215423293e443469a07ae7011135d058b671Garrett Cooper
399ca9633cb75c407a81b98673891982b2e0702b29Cyril Hrubis	printf("Unresolved test error\n");
40354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao	return PTS_UNRESOLVED;
41ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman}
42