xref: /netbsd-src/tests/rump/rumpkern/t_modlinkset.c (revision 9f4a9600be3013fd256265533fbb085e3c80d678)
1*9f4a9600Sandvar /*	$NetBSD: t_modlinkset.c,v 1.4 2022/05/24 06:28:02 andvar Exp $	*/
27d89931cSpooka 
37d89931cSpooka /*
47d89931cSpooka  * Copyright (c) 2009 The NetBSD Foundation, Inc.
57d89931cSpooka  * All rights reserved.
67d89931cSpooka  *
77d89931cSpooka  * Redistribution and use in source and binary forms, with or without
87d89931cSpooka  * modification, are permitted provided that the following conditions
97d89931cSpooka  * are met:
107d89931cSpooka  * 1. Redistributions of source code must retain the above copyright
117d89931cSpooka  *    notice, this list of conditions and the following disclaimer.
127d89931cSpooka  * 2. Redistributions in binary form must reproduce the above copyright
137d89931cSpooka  *    notice, this list of conditions and the following disclaimer in the
147d89931cSpooka  *    documentation and/or other materials provided with the distribution.
157d89931cSpooka  *
167d89931cSpooka  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
177d89931cSpooka  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
187d89931cSpooka  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
197d89931cSpooka  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
207d89931cSpooka  * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
217d89931cSpooka  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
227d89931cSpooka  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
237d89931cSpooka  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
247d89931cSpooka  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
257d89931cSpooka  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
267d89931cSpooka  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
277d89931cSpooka  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
287d89931cSpooka  */
297d89931cSpooka 
307d89931cSpooka #include <sys/types.h>
317d89931cSpooka #include <sys/mount.h>
327d89931cSpooka 
337d89931cSpooka #include <rump/rump.h>
347d89931cSpooka #include <rump/ukfs.h>
357d89931cSpooka 
367d89931cSpooka #include <atf-c.h>
377d89931cSpooka #include <dlfcn.h>
387d89931cSpooka #include <err.h>
397d89931cSpooka #include <errno.h>
407d89931cSpooka #include <string.h>
417d89931cSpooka 
42c54cb811Schristos #include "h_macros.h"
437d89931cSpooka 
447d89931cSpooka ATF_TC(modlinkset);
ATF_TC_HEAD(modlinkset,tc)457d89931cSpooka ATF_TC_HEAD(modlinkset, tc)
467d89931cSpooka {
477d89931cSpooka 	atf_tc_set_md_var(tc, "descr", "Check that module linkset bootstrap "
487d89931cSpooka 	    "works");
497d89931cSpooka }
507d89931cSpooka 
517d89931cSpooka /*
52*9f4a9600Sandvar  * We link against cd9660 and msdosfs (both chosen because the names
537d89931cSpooka  * are unlikely to ever be a substring of a another file system).
547d89931cSpooka  * Without proper linkset handling at most one will be reported.
557d89931cSpooka  */
ATF_TC_BODY(modlinkset,tc)567d89931cSpooka ATF_TC_BODY(modlinkset, tc)
577d89931cSpooka {
587d89931cSpooka 	char buf[1024];
597d89931cSpooka 
607d89931cSpooka 	rump_init();
617d89931cSpooka 	if (ukfs_vfstypes(buf, sizeof(buf)) == -1)
627d89931cSpooka 		atf_tc_fail_errno("ukfs_vfstypes");
637d89931cSpooka 
647d89931cSpooka 	ATF_CHECK((strstr(buf, "msdos") != NULL));
657d89931cSpooka 	ATF_CHECK((strstr(buf, "cd9660") != NULL));
667d89931cSpooka }
677d89931cSpooka 
ATF_TP_ADD_TCS(tp)687d89931cSpooka ATF_TP_ADD_TCS(tp)
697d89931cSpooka {
707d89931cSpooka 	ATF_TP_ADD_TC(tp, modlinkset);
71aebec17aSpooka 
72aebec17aSpooka 	return atf_no_error();
737d89931cSpooka }
74