Author: ngie
Date: Sat Apr 11 06:40:38 2015
New Revision: 281408
URL: https://svnweb.freebsd.org/changeset/base/281408

Log:
  - Remove the .t wrapper and put the "magic" of determining the number of
    testcases into the .c file
  - Require root for now because it fails with SOCK_RAW without root privileges
  - Increment the test count properly on socket create failure
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Deleted:
  head/tools/regression/sockets/so_setfib/so_setfib.t
Modified:
  head/tools/regression/sockets/so_setfib/so_setfib.c

Modified: head/tools/regression/sockets/so_setfib/so_setfib.c
==============================================================================
--- head/tools/regression/sockets/so_setfib/so_setfib.c Sat Apr 11 06:38:50 
2015        (r281407)
+++ head/tools/regression/sockets/so_setfib/so_setfib.c Sat Apr 11 06:40:38 
2015        (r281408)
@@ -45,6 +45,7 @@
  * 5. Repeat for next domain family and type from (2) on.
  */
 
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/sysctl.h>
@@ -143,6 +144,7 @@ t(u_int dom, u_int type)
        if (s == -1) {
                printf("not ok %d %s_%s # socket(): %s\n", testno,
                    t_dom[dom].name, t_type[type].name, strerror(errno));
+               testno++;
                return;
        }
        
@@ -168,6 +170,11 @@ main(int argc __unused, char *argv[] __u
        u_int i, j;
        size_t s;
 
+       if (geteuid() != 0) {
+               printf("1..0 # SKIP: must be root");
+               return (0);
+       }
+
        /* Initalize randomness. */
        srandomdev();
 
@@ -175,6 +182,10 @@ main(int argc __unused, char *argv[] __u
        s = sizeof(rt_numfibs);
        if (sysctlbyname("net.fibs", &rt_numfibs, &s, NULL, 0) == -1)
                err(1, "sysctlbyname(net.fibs, ..)");
+
+       printf("1..%lu\n",
+           (nitems(t_dom) - 1) * nitems(t_type) * (2 + rt_numfibs + 2 + 3));
+
        /* Adjust from number to index. */
        rt_numfibs -= 1;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to