 11be35a165
			
		
	
	
		11be35a165
		
	
	
	
	
		
			
			To do so, a few dependencies have been imported: * external/bsd/lutok * external/mit/lua * external/public-domain/sqlite * external/public-domain/xz The Kyua framework is the new generation of ATF (Automated Test Framework), it is composed of: * external/bsd/atf * external/bsd/kyua-atf-compat * external/bsd/kyua-cli * external/bsd/kyua-tester * tests Kyua/ATF being written in C++, it depends on libstdc++ which is provided by GCC. As this is not part of the sources, Kyua is only compiled when the native GCC utils are installed. To install Kyua do the following: * In a cross-build enviromnent, add the following to the build.sh commandline: -V MKBINUTILS=yes -V MKGCCCMDS=yes WARNING: At this point the import is still experimental, and not supported on native builds (a.k.a make build). Change-Id: I26aee23c5bbd2d64adcb7c1beb98fe0d479d7ada
		
			
				
	
	
		
			84 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*	$NetBSD: t_compat.c,v 1.1 2010/11/07 19:53:42 pooka Exp $	*/
 | |
| 
 | |
| #include <sys/socket.h>
 | |
| #include <sys/ioctl.h>
 | |
| #include <net/if.h>
 | |
| #include <netinet/in.h>
 | |
| 
 | |
| #include <string.h>
 | |
| #include <stdio.h>
 | |
| #include <stdlib.h>
 | |
| 
 | |
| #include <rump/rump.h>
 | |
| #include <rump/rump_syscalls.h>
 | |
| 
 | |
| #include "../config/netconfig.c"
 | |
| 
 | |
| /*
 | |
|  * Test for stack smashing in compat ioctl handling.  Adapted as an
 | |
|  * atf test from code provided by Onno van der Linden in PR kern/44054
 | |
|  */
 | |
| 
 | |
| struct oifreq {
 | |
|         char    ifr_name[IFNAMSIZ];             /* if name, e.g. "en0" */
 | |
|         union {
 | |
|                 struct  sockaddr ifru_addr;
 | |
|                 struct  sockaddr ifru_dstaddr;
 | |
|                 struct  sockaddr ifru_broadaddr;
 | |
|                 short   ifru_flags;  
 | |
|                 int     ifru_metric;
 | |
|                 int     ifru_mtu; 
 | |
|                 int     ifru_dlt;
 | |
|                 u_int   ifru_value;
 | |
|                 void *  ifru_data;
 | |
|                 struct {
 | |
|                         uint32_t        b_buflen;
 | |
|                         void            *b_buf;
 | |
|                 } ifru_b;
 | |
|         } ifr_ifru;
 | |
| };      
 | |
| #define OOSIOCGIFBRDADDR _IOWR('i', 18, struct oifreq)
 | |
| 
 | |
| ATF_TC(OOSIOCGIFBRDADDR);
 | |
| ATF_TC_HEAD(OOSIOCGIFBRDADDR, tc)
 | |
| {
 | |
| 
 | |
| 	atf_tc_set_md_var(tc, "descr", "Checks that OOSIOCGIFBRDADDR works "
 | |
| 	    "(PR kern/44054)");
 | |
| }
 | |
| 
 | |
| ATF_TC_BODY(OOSIOCGIFBRDADDR, tc)
 | |
| {
 | |
|         int fd, ifnum;
 | |
|         struct oifreq ifreq;
 | |
|         struct sockaddr_in *sin;
 | |
| 	int rv;
 | |
| 
 | |
|         memset(&ifreq,'\0',sizeof ifreq);
 | |
| 
 | |
| 	rump_init();
 | |
| 
 | |
| 	/* create an interface and give it netmask 0xffff0000 */
 | |
| 	rv = rump_pub_shmif_create("bus", &ifnum);
 | |
| 	if (rv)
 | |
| 		atf_tc_fail("failed to create shmif: %s", strerror(rv));
 | |
| 	sprintf(ifreq.ifr_name, "shmif%d", ifnum);
 | |
| 	netcfg_rump_if(ifreq.ifr_name, "1.7.64.10", "255.255.0.0");
 | |
| 
 | |
| 	/* query kernel for iface bcast */
 | |
|         RL(fd = rump_sys_socket(AF_INET, SOCK_DGRAM, 0));
 | |
|         RL(rump_sys_ioctl(fd, OOSIOCGIFBRDADDR, &ifreq));
 | |
| 
 | |
| 	/* make sure we got what we deserve */
 | |
|         sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
 | |
| 	ATF_REQUIRE_EQ(sin->sin_addr.s_addr, htonl(0x0107ffff));
 | |
|         rump_sys_close(fd);
 | |
| }
 | |
| 
 | |
| ATF_TP_ADD_TCS(tp)
 | |
| {
 | |
| 
 | |
| 	ATF_TP_ADD_TC(tp, OOSIOCGIFBRDADDR);
 | |
| 	return atf_no_error();
 | |
| }
 |