xref: /freebsd-src/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c (revision 1a36faad54665288ed4eb839d2a4699ae2ead45e)
1*63d1fd59SEnji Cooper /*	$NetBSD: t_modlinkset.c,v 1.3 2017/01/13 21:30:43 christos Exp $	*/
257718be8SEnji Cooper 
357718be8SEnji Cooper /*
457718be8SEnji Cooper  * Copyright (c) 2009 The NetBSD Foundation, Inc.
557718be8SEnji Cooper  * All rights reserved.
657718be8SEnji Cooper  *
757718be8SEnji Cooper  * Redistribution and use in source and binary forms, with or without
857718be8SEnji Cooper  * modification, are permitted provided that the following conditions
957718be8SEnji Cooper  * are met:
1057718be8SEnji Cooper  * 1. Redistributions of source code must retain the above copyright
1157718be8SEnji Cooper  *    notice, this list of conditions and the following disclaimer.
1257718be8SEnji Cooper  * 2. Redistributions in binary form must reproduce the above copyright
1357718be8SEnji Cooper  *    notice, this list of conditions and the following disclaimer in the
1457718be8SEnji Cooper  *    documentation and/or other materials provided with the distribution.
1557718be8SEnji Cooper  *
1657718be8SEnji Cooper  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
1757718be8SEnji Cooper  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
1857718be8SEnji Cooper  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1957718be8SEnji Cooper  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2057718be8SEnji Cooper  * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
2157718be8SEnji Cooper  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2257718be8SEnji Cooper  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2357718be8SEnji Cooper  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2457718be8SEnji Cooper  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2557718be8SEnji Cooper  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2657718be8SEnji Cooper  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2757718be8SEnji Cooper  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2857718be8SEnji Cooper  */
2957718be8SEnji Cooper 
3057718be8SEnji Cooper #include <sys/types.h>
3157718be8SEnji Cooper #include <sys/mount.h>
3257718be8SEnji Cooper 
3357718be8SEnji Cooper #include <rump/rump.h>
3457718be8SEnji Cooper #include <rump/ukfs.h>
3557718be8SEnji Cooper 
3657718be8SEnji Cooper #include <atf-c.h>
3757718be8SEnji Cooper #include <dlfcn.h>
3857718be8SEnji Cooper #include <err.h>
3957718be8SEnji Cooper #include <errno.h>
4057718be8SEnji Cooper #include <string.h>
4157718be8SEnji Cooper 
42*63d1fd59SEnji Cooper #include "h_macros.h"
4357718be8SEnji Cooper 
4457718be8SEnji Cooper ATF_TC(modlinkset);
ATF_TC_HEAD(modlinkset,tc)4557718be8SEnji Cooper ATF_TC_HEAD(modlinkset, tc)
4657718be8SEnji Cooper {
4757718be8SEnji Cooper 	atf_tc_set_md_var(tc, "descr", "Check that module linkset bootstrap "
4857718be8SEnji Cooper 	    "works");
4957718be8SEnji Cooper }
5057718be8SEnji Cooper 
5157718be8SEnji Cooper /*
5257718be8SEnji Cooper  * We link against cd9660 and msdosfs (both chosed because the names
5357718be8SEnji Cooper  * are unlikely to ever be a substring of a another file system).
5457718be8SEnji Cooper  * Without proper linkset handling at most one will be reported.
5557718be8SEnji Cooper  */
ATF_TC_BODY(modlinkset,tc)5657718be8SEnji Cooper ATF_TC_BODY(modlinkset, tc)
5757718be8SEnji Cooper {
5857718be8SEnji Cooper 	char buf[1024];
5957718be8SEnji Cooper 
6057718be8SEnji Cooper 	rump_init();
6157718be8SEnji Cooper 	if (ukfs_vfstypes(buf, sizeof(buf)) == -1)
6257718be8SEnji Cooper 		atf_tc_fail_errno("ukfs_vfstypes");
6357718be8SEnji Cooper 
6457718be8SEnji Cooper 	ATF_CHECK((strstr(buf, "msdos") != NULL));
6557718be8SEnji Cooper 	ATF_CHECK((strstr(buf, "cd9660") != NULL));
6657718be8SEnji Cooper }
6757718be8SEnji Cooper 
ATF_TP_ADD_TCS(tp)6857718be8SEnji Cooper ATF_TP_ADD_TCS(tp)
6957718be8SEnji Cooper {
7057718be8SEnji Cooper 	ATF_TP_ADD_TC(tp, modlinkset);
7157718be8SEnji Cooper 
7257718be8SEnji Cooper 	return atf_no_error();
7357718be8SEnji Cooper }
74