Skip to content

Commit

Permalink
Retire test38
Browse files Browse the repository at this point in the history
  • Loading branch information
tleguern committed Sep 6, 2018
1 parent 60a1160 commit 38b80dd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 54 deletions.
2 changes: 1 addition & 1 deletion regress/README
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test34: Create a tun0 persistent device and destroy it
test35: Create a tap0 persistent device and release it
test36: Create a tun1 persistent device and release it
test37: Set a log callback and generate an error
test38: Set a log callback and generate all possible error levels
test38: Nothing (previously: Set a log callback and generate all possible error levels)
test39: Enable debug for a tap device
test40: Enable debug for a tun device
test41: Set a new name to an interface
Expand Down
53 changes: 0 additions & 53 deletions regress/test38.c
Original file line number Diff line number Diff line change
@@ -1,60 +1,7 @@
/* Public domain - Tristan Le Guern <tleguern@bouledef.eu> */

#include <sys/types.h>

#include <stdio.h>
#if defined Windows
# include <windows.h>
#endif

#include "tuntap.h"

int debug, info, notice, warn, err;

void
test_cb(int level, const char *errmsg) {
const char *prefix = NULL;

switch (level) {
case TUNTAP_LOG_DEBUG:
prefix = "debug";
debug = 1;
break;
case TUNTAP_LOG_INFO:
prefix = "info";
info = 1;
break;
case TUNTAP_LOG_NOTICE:
prefix = "notice";
notice = 1;
break;
case TUNTAP_LOG_WARN:
prefix = "warn";
warn = 1;
break;
case TUNTAP_LOG_ERR:
prefix = "err";
err = 1;
break;
default:
/* NOTREACHED */
break;
}
(void)fprintf(stderr, "%s: %s\n", prefix, errmsg);
}

int
main(void) {
tuntap_log_set_cb(test_cb);

tuntap_log(TUNTAP_LOG_DEBUG, "debug message");
tuntap_log(TUNTAP_LOG_INFO, "info message");
tuntap_log(TUNTAP_LOG_NOTICE, "notice message");
tuntap_log(TUNTAP_LOG_WARN, "warn message");
tuntap_log(TUNTAP_LOG_ERR, "err message");

if (debug + info + notice + warn + err != 5)
return -1;
return 0;
}

0 comments on commit 38b80dd

Please sign in to comment.