t_workqueue.c revision 1.2.2.2 1 1.2.2.2 martin /* $NetBSD: t_workqueue.c,v 1.2.2.2 2018/01/16 13:01:10 martin Exp $ */
2 1.2.2.2 martin
3 1.2.2.2 martin /*-
4 1.2.2.2 martin * Copyright (c) 2017 The NetBSD Foundation, Inc.
5 1.2.2.2 martin * All rights reserved.
6 1.2.2.2 martin *
7 1.2.2.2 martin * Redistribution and use in source and binary forms, with or without
8 1.2.2.2 martin * modification, are permitted provided that the following conditions
9 1.2.2.2 martin * are met:
10 1.2.2.2 martin * 1. Redistributions of source code must retain the above copyright
11 1.2.2.2 martin * notice, this list of conditions and the following disclaimer.
12 1.2.2.2 martin * 2. Redistributions in binary form must reproduce the above copyright
13 1.2.2.2 martin * notice, this list of conditions and the following disclaimer in the
14 1.2.2.2 martin * documentation and/or other materials provided with the distribution.
15 1.2.2.2 martin *
16 1.2.2.2 martin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 1.2.2.2 martin * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 1.2.2.2 martin * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 1.2.2.2 martin * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.2.2.2 martin * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 1.2.2.2 martin * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.2.2.2 martin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 1.2.2.2 martin * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.2.2.2 martin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 1.2.2.2 martin * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 1.2.2.2 martin * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 1.2.2.2 martin * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 1.2.2.2 martin */
29 1.2.2.2 martin
30 1.2.2.2 martin #include <sys/types.h>
31 1.2.2.2 martin #include <sys/mount.h>
32 1.2.2.2 martin #include <sys/sysctl.h>
33 1.2.2.2 martin
34 1.2.2.2 martin #include <rump/rump.h>
35 1.2.2.2 martin
36 1.2.2.2 martin #include <atf-c.h>
37 1.2.2.2 martin
38 1.2.2.2 martin #include "h_macros.h"
39 1.2.2.2 martin #include "../kernspace/kernspace.h"
40 1.2.2.2 martin
41 1.2.2.2 martin ATF_TC(workqueue1);
42 1.2.2.2 martin ATF_TC_HEAD(workqueue1, tc)
43 1.2.2.2 martin {
44 1.2.2.2 martin
45 1.2.2.2 martin atf_tc_set_md_var(tc, "descr", "Checks workqueue basics");
46 1.2.2.2 martin }
47 1.2.2.2 martin
48 1.2.2.2 martin ATF_TC_BODY(workqueue1, tc)
49 1.2.2.2 martin {
50 1.2.2.2 martin
51 1.2.2.2 martin rump_init();
52 1.2.2.2 martin
53 1.2.2.2 martin rump_schedule();
54 1.2.2.2 martin rumptest_workqueue1(); /* panics if fails */
55 1.2.2.2 martin rump_unschedule();
56 1.2.2.2 martin }
57 1.2.2.2 martin
58 1.2.2.2 martin ATF_TC(workqueue_wait);
59 1.2.2.2 martin ATF_TC_HEAD(workqueue_wait, tc)
60 1.2.2.2 martin {
61 1.2.2.2 martin
62 1.2.2.2 martin atf_tc_set_md_var(tc, "descr", "Checks workqueue_wait");
63 1.2.2.2 martin }
64 1.2.2.2 martin
65 1.2.2.2 martin ATF_TC_BODY(workqueue_wait, tc)
66 1.2.2.2 martin {
67 1.2.2.2 martin
68 1.2.2.2 martin rump_init();
69 1.2.2.2 martin
70 1.2.2.2 martin rump_schedule();
71 1.2.2.2 martin rumptest_workqueue_wait(); /* panics if fails */
72 1.2.2.2 martin rump_unschedule();
73 1.2.2.2 martin }
74 1.2.2.2 martin
75 1.2.2.2 martin ATF_TP_ADD_TCS(tp)
76 1.2.2.2 martin {
77 1.2.2.2 martin ATF_TP_ADD_TC(tp, workqueue1);
78 1.2.2.2 martin ATF_TP_ADD_TC(tp, workqueue_wait);
79 1.2.2.2 martin
80 1.2.2.2 martin return atf_no_error();
81 1.2.2.2 martin }
82