• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
4  *
5  * Author: Aniruddha Marathe <aniruddha.marathe@wipro.com>
6  *
7  * Ported to new library:
8  * 07/2019      Christian Amann <camann@suse.com>
9  */
10 /*
11  * Basic error handling test for timer_delete(2):
12  *
13  *	This test case checks whether timer_delete(2) returns an appropriate
14  *	error (EINVAL) for an invalid timerid parameter
15  */
16 
17 #include <errno.h>
18 #include <time.h>
19 #include "tst_test.h"
20 #include "lapi/common_timers.h"
21 
22 #define INVALID_ID ((kernel_timer_t)-1)
23 
run(void)24 static void run(void)
25 {
26 	TEST(tst_syscall(__NR_timer_delete, INVALID_ID));
27 
28 	if (TST_RET == -1 && TST_ERR == EINVAL) {
29 		tst_res(TPASS | TTERRNO,
30 			 "Failed as expected");
31 	} else {
32 		tst_res(TFAIL | TTERRNO,
33 			 "Didn't fail with EINVAL as expected - got");
34 	}
35 }
36 
37 static struct tst_test test = {
38 	.test_all = run,
39 };
40