]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[libnozzle] add api_nozzle_run_updown tests
authorFabio M. Di Nitto <fdinitto@redhat.com>
Fri, 14 Dec 2018 10:59:11 +0000 (11:59 +0100)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 18 Dec 2018 08:30:23 +0000 (09:30 +0100)
and cleanup lots of craft around related to the old testing method
for the same API

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
16 files changed:
libnozzle/libnozzle.c
libnozzle/libnozzle.h
libnozzle/tests/Makefile.am
libnozzle/tests/api_nozzle_run_updown.c [new file with mode: 0644]
libnozzle/tests/int_execute_bin_sh_command.c
libnozzle/tests/nozzle_run_updown_exit_false [new file with mode: 0755]
libnozzle/tests/nozzle_run_updown_exit_true [new file with mode: 0755]
libnozzle/tests/nozzle_test.c
libnozzle/tests/tap_updown_bad/down.d/kronostest [deleted file]
libnozzle/tests/tap_updown_bad/post-down.d/kronostest [deleted file]
libnozzle/tests/tap_updown_bad/pre-up.d/kronostest [deleted file]
libnozzle/tests/tap_updown_bad/up.d/kronostest [deleted file]
libnozzle/tests/tap_updown_good/down.d/kronostest [deleted file]
libnozzle/tests/tap_updown_good/post-down.d/kronostest [deleted file]
libnozzle/tests/tap_updown_good/pre-up.d/kronostest [deleted file]
libnozzle/tests/tap_updown_good/up.d/kronostest [deleted file]

index 05bf0c4b407693b68ca6763422a0789934112c4d..f04f4161d37004292e72fca8a631f6e1d9d9b035 100644 (file)
@@ -668,7 +668,7 @@ int nozzle_run_updown(const nozzle_t nozzle, uint8_t action, char **exec_string)
 
        memset(command, 0, PATH_MAX);
 
-       snprintf(command, PATH_MAX, "%s%s/%s", nozzle->updownpath, action_str, nozzle->name);
+       snprintf(command, PATH_MAX, "%s/%s/%s", nozzle->updownpath, action_str, nozzle->name);
 
        err = stat(command, &sb);
        if (err) {
@@ -676,8 +676,15 @@ int nozzle_run_updown(const nozzle_t nozzle, uint8_t action, char **exec_string)
                goto out_clean;
        }
 
+       /*
+        * clear errno from previous calls as there is no errno
+        * returned from execute_bin_sh_command
+        */
+       savederrno = 0;
        err = execute_bin_sh_command(command, exec_string);
-       savederrno = errno;
+       if (err) {
+               err = -2;
+       }
 
 out_clean:
        pthread_mutex_unlock(&config_mutex);
index df3d9fb56fb6756979d30699148ffa0db1b8527e..6baf09eed56211fa701d62959e5e668aa3a346ab 100644 (file)
@@ -88,7 +88,8 @@ int nozzle_close(nozzle_t nozzle);
  *
  * @return
  * 0 on success
- * -1 on error and errno is set.
+ * -1 on error and errno is set (sanity checks and internal calls.
+ * -2 on error from executing the shell scripts, and no errno is set.
  */
 
 int nozzle_run_updown(const nozzle_t nozzle, uint8_t action, char **exec_string);
index 4a53ea4447cdc0526ce2b577963075fa28c25b7d..64af8388b7b3f747464015c7dfde5ff03c55d8b1 100644 (file)
@@ -11,8 +11,8 @@ MAINTAINERCLEANFILES  = Makefile.in
 include $(top_srcdir)/build-aux/check.mk
 
 EXTRA_DIST             = \
-                         tap_updown_bad \
-                         tap_updown_good \
+                         nozzle_run_updown_exit_true \
+                         nozzle_run_updown_exit_false \
                          api-test-coverage
 
 noinst_HEADERS         = \
@@ -31,7 +31,8 @@ api_checks            = \
                          api_nozzle_set_mac_test \
                          api_nozzle_get_handle_by_name_test \
                          api_nozzle_get_name_by_handle_test \
-                         api_nozzle_get_fd_test
+                         api_nozzle_get_fd_test \
+                         api_nozzle_run_updown_test
 
 int_checks             = \
                          int_execute_bin_sh_command_test \
@@ -61,7 +62,7 @@ check-api-test-coverage:
        chmod u+x $(top_srcdir)/libnozzle/tests/api-test-coverage
        $(top_srcdir)/libnozzle/tests/api-test-coverage $(top_srcdir) $(top_builddir)
 
-AM_CPPFLAGS            = -I$(top_srcdir)/libnozzle -DABSBUILDDIR=\"$(abs_builddir)\"
+AM_CPPFLAGS            = -I$(top_srcdir)/libnozzle -DABSBUILDDIR=\"$(abs_builddir)\" -DABSSRCDIR=\"$(abs_srcdir)\"
 AM_CFLAGS              += $(PTHREAD_CFLAGS) $(libnl_CFLAGS)
 LIBS                   += $(top_builddir)/libnozzle/libnozzle.la $(PTHREAD_LIBS) $(libnl_LIBS)
 
@@ -101,6 +102,10 @@ api_nozzle_get_name_by_handle_test_SOURCES = api_nozzle_get_name_by_handle.c \
 api_nozzle_get_fd_test_SOURCES = api_nozzle_get_fd.c \
                                 test-common.c
 
+api_nozzle_run_updown_test_SOURCES = api_nozzle_run_updown.c \
+                                    test-common.c \
+                                    ../internals.c
+
 int_execute_bin_sh_command_test_SOURCES = int_execute_bin_sh_command.c \
                                          test-common.c \
                                          ../internals.c
diff --git a/libnozzle/tests/api_nozzle_run_updown.c b/libnozzle/tests/api_nozzle_run_updown.c
new file mode 100644 (file)
index 0000000..89bf909
--- /dev/null
@@ -0,0 +1,401 @@
+/*
+ * Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
+ *
+ * Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
+ *
+ * This software licensed under GPL-2.0+, LGPL-2.0+
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdint.h>
+#include <limits.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "test-common.h"
+
+static int test(void)
+{
+       char device_name[IFNAMSIZ];
+       size_t size = IFNAMSIZ;
+       int err=0;
+       nozzle_t nozzle = NULL;
+       char *error_string = NULL;
+       char *tmpdir = NULL;
+       char tmpdirsrc[PATH_MAX];
+       char tmpstr[PATH_MAX*2];
+       char srcfile[PATH_MAX];
+       char dstfile[PATH_MAX];
+
+       /*
+        * create a tmp dir for storing up/down scripts.
+        * we cannot create symlinks src dir
+        */
+       strcpy(tmpdirsrc, ABSBUILDDIR "/nozzle_test_XXXXXX");
+
+       tmpdir = mkdtemp(tmpdirsrc);
+       if (!tmpdir) {
+               printf("Unable to create temporary directory %s for testing: %s\n", tmpdirsrc, strerror(errno));
+               return -1;
+       }
+
+       printf("Created temporary test dir: %s\n", tmpdir);
+
+       printf("Populating test dir...\n");
+
+       snprintf(tmpstr, sizeof(tmpstr) - 1, "%s/pre-up.d", tmpdir);
+       if (mkdir(tmpstr, 0700) < 0) {
+               printf("Unable to create %s/pre-up.d: %s", tmpdir, strerror(errno));
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(tmpstr, sizeof(tmpstr) - 1, "%s/up.d", tmpdir);
+       if (mkdir(tmpstr, 0700) < 0) {
+               printf("Unable to create %s/up.d: %s", tmpdir, strerror(errno));
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(tmpstr, sizeof(tmpstr) - 1, "%s/down.d", tmpdir);
+       if (mkdir(tmpstr, 0700) < 0) {
+               printf("Unable to create %s/down.d: %s", tmpdir, strerror(errno));
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(tmpstr, sizeof(tmpstr) - 1, "%s/post-down.d", tmpdir);
+       if (mkdir(tmpstr, 0700) < 0) {
+               printf("Unable to create %s/post-down.d: %s", tmpdir, strerror(errno));
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing error conditions\n");
+
+       printf("Init nozzle device with no path\n");
+
+       memset(device_name, 0, size);
+       nozzle = nozzle_open(device_name, size, NULL);
+       if (!nozzle) {
+               printf("Unable to init %s\n", device_name);
+               err = -1;
+               goto out_clean;
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
+       if ((!err) || (errno != EINVAL)) {
+               printf("nozzle_run_updown sanity check failed\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       nozzle_close(nozzle);
+
+       printf("Init nozzle device with path\n");
+
+       memset(device_name, 0, size);
+       nozzle = nozzle_open(device_name, size, tmpdir);
+       if (!nozzle) {
+               printf("Unable to init %s\n", device_name);
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing invalid nozzle handle\n");
+
+       err = nozzle_run_updown(NULL, NOZZLE_POSTDOWN, &error_string);
+       if ((!err) || (errno != EINVAL)) {
+               printf("nozzle_run_updown sanity check failed\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing invalid action\n");
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN + 1, &error_string);
+       if ((!err) || (errno != EINVAL)) {
+               printf("nozzle_run_updown sanity check failed\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing invalid error string\n");
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN + 1, NULL);
+       if ((!err) || (errno != EINVAL)) {
+               printf("nozzle_run_updown sanity check failed\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing interface pre-up/up/down/post-down (no scripts installed)\n");
+
+       err = nozzle_run_updown(nozzle, NOZZLE_PREUP, &error_string);
+       if (!err) {
+               printf("nozzle_run_updown failed to detect lack of script in pre-up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_UP, &error_string);
+       if (!err) {
+               printf("nozzle_run_updown failed to detect lack of script in up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_DOWN, &error_string);
+       if (!err) {
+               printf("nozzle_run_updown failed to detect lack of script in down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
+       if (!err) {
+               printf("nozzle_run_updown failed to detect lack of script in post-down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       printf("Populating test dir with fail scripts\n");
+
+       snprintf(srcfile, sizeof(srcfile) - 1, "%s/nozzle_run_updown_exit_false", ABSSRCDIR);
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/pre-up.d/%s", tmpdir, device_name);
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/up.d/%s", tmpdir, device_name);
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/down.d/%s", tmpdir, device_name);
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/post-down.d/%s", tmpdir, device_name);
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing interface pre-up/up/down/post-down (FAIL scripts installed)\n");
+
+       err = nozzle_run_updown(nozzle, NOZZLE_PREUP, &error_string);
+       if (err != -2) {
+               printf("nozzle_run_updown failed to detect script failure in pre-up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_UP, &error_string);
+       if (err != -2) {
+               printf("nozzle_run_updown failed to detect script failure in up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_DOWN, &error_string);
+       if (err != -2) {
+               printf("nozzle_run_updown failed to detect script failure in down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
+       if (err != -2) {
+               printf("nozzle_run_updown failed to detect script failure in post-down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       printf("Populating test dir with true scripts\n");
+
+       snprintf(srcfile, sizeof(srcfile) - 1, "%s/nozzle_run_updown_exit_true", ABSSRCDIR);
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/pre-up.d/%s", tmpdir, device_name);
+       if (unlink(dstfile) < 0) {
+               printf("unable to remove old symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/up.d/%s", tmpdir, device_name);
+       if (unlink(dstfile) < 0) {
+               printf("unable to remove old symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/down.d/%s", tmpdir, device_name);
+       if (unlink(dstfile) < 0) {
+               printf("unable to remove old symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       snprintf(dstfile, sizeof(dstfile) - 1, "%s/post-down.d/%s", tmpdir, device_name);
+       if (unlink(dstfile) < 0) {
+               printf("unable to remove old symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+       if (link(srcfile, dstfile) < 0) {
+               printf("unable to create symlink\n");
+               err = -1;
+               goto out_clean;
+       }
+
+       printf("Testing interface pre-up/up/down/post-down (TRUE scripts installed)\n");
+
+       err = nozzle_run_updown(nozzle, NOZZLE_PREUP, &error_string);
+       if (err) {
+               printf("nozzle_run_updown failed to execute true script in pre-up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_UP, &error_string);
+       if (err) {
+               printf("nozzle_run_updown failed to execute true script in up.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_DOWN, &error_string);
+       if (err) {
+               printf("nozzle_run_updown failed to execite true script in down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
+       if (err) {
+               printf("nozzle_run_updown failed to execute true script in post-down.d\n");
+               err = -1;
+               goto out_clean;
+       } else {
+               if (error_string) {
+                       free(error_string);
+                       error_string = NULL;
+               }
+       }
+
+
+out_clean:
+       if (tmpdir) {
+               snprintf(tmpstr, sizeof(tmpstr) - 1, "rm -rf %s", tmpdir);
+               printf("Removing temporary dir: %s\n", tmpstr);
+               err = execute_bin_sh_command(tmpstr, &error_string);
+               if (err) {
+                       printf("Error removing directory: %s\n", error_string);
+               }
+               if (error_string) {
+                       free(error_string);
+               }
+       }
+       if (nozzle) {
+               nozzle_close(nozzle);
+       }
+
+       return err;
+}
+
+int main(void)
+{
+       need_root();
+
+       if (test() < 0)
+               return FAIL;
+
+       return PASS;
+}
index b1b0a42f16f05c7f8e882d04e8f4ca32ecca75ed..c5a7e5d4773bf65924575c3dc7a0105fda7b5a9e 100644 (file)
 static int test(void)
 {
        int err = 0;
-       char command[4096];
        char *error_string = NULL;
 
-       memset(command, 0, sizeof(command));
-
        printf("Testing execute_bin_sh_command\n");
 
        printf("command true\n");
diff --git a/libnozzle/tests/nozzle_run_updown_exit_false b/libnozzle/tests/nozzle_run_updown_exit_false
new file mode 100755 (executable)
index 0000000..721ecb6
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
+#
+# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
+#
+# This software licensed under GPL-2.0+, LGPL-2.0+
+#
+
+exit 1
diff --git a/libnozzle/tests/nozzle_run_updown_exit_true b/libnozzle/tests/nozzle_run_updown_exit_true
new file mode 100755 (executable)
index 0000000..6e28da1
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
+#
+# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
+#
+# This software licensed under GPL-2.0+, LGPL-2.0+
+#
+
+exit 0
index ad1ab79d42e59af2710449a1a5b612152e4a8df5..475035d0f4c93fadefe341cf92cde32ef453060d 100644 (file)
@@ -24,240 +24,6 @@ char testipv4_2[IPBUFSIZE];
 char testipv6_1[IPBUFSIZE];
 char testipv6_2[IPBUFSIZE];
 
-static int check_knet_up_down(void)
-{
-       char verifycmd[1024];
-       char device_name[IFNAMSIZ];
-       size_t size = IFNAMSIZ;
-       int err=0;
-       nozzle_t nozzle;
-       char *error_string = NULL;
-
-       printf("Testing interface up/down\n");
-
-       memset(device_name, 0, size);
-       nozzle = nozzle_open(device_name, size, NULL);
-       if (!nozzle) {
-               printf("Unable to init %s\n", device_name);
-               return -1;
-       }
-
-       printf("Put the interface up\n");
-
-       err = nozzle_set_up(nozzle);
-       if (err < 0) {
-               printf("Unable to set interface up\n");
-               err = -1;
-               goto out_clean;
-       }
-
-       memset(verifycmd, 0, sizeof(verifycmd));
-       snprintf(verifycmd, sizeof(verifycmd)-1,
-#ifdef KNET_LINUX
-                "ip addr show dev %s | grep -q UP", nozzle->name);
-#endif
-#ifdef KNET_BSD
-                "ifconfig %s | grep -q UP", nozzle->name);
-#endif
-       err = execute_bin_sh_command(verifycmd, &error_string);
-       if (error_string) {
-               printf("Error string: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       if (err < 0) {
-               printf("Unable to verify inteface UP\n");
-               err = -1;
-               goto out_clean;
-       }
-
-       printf("Put the interface down\n");
-
-       err = nozzle_set_down(nozzle);
-       if (err < 0) {
-               printf("Unable to put the interface down\n");
-               err = -1;
-               goto out_clean;
-       }
-
-       memset(verifycmd, 0, sizeof(verifycmd));
-       snprintf(verifycmd, sizeof(verifycmd)-1,
-#ifdef KNET_LINUX
-                "ip addr show dev %s | grep -q UP", nozzle->name);
-#endif
-#ifdef KNET_BSD
-                "ifconfig %s | grep -q UP", nozzle->name);
-#endif
-       err = execute_bin_sh_command(verifycmd, &error_string);
-       if (error_string) {
-               printf("Error string: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       if (!err) {
-               printf("Unable to verify inteface DOWN\n");
-               err = -1;
-               goto out_clean;
-       }
-
-       nozzle_close(nozzle);
-
-       printf("Testing interface pre-up/up/down/post-down (exec errors)\n");
-
-       memset(device_name, 0, size);
-       nozzle = nozzle_open(device_name, size, ABSBUILDDIR "/nozzle_updown_bad");
-       if (!nozzle) {
-               printf("Unable to init %s\n", device_name);
-               return -1;
-       }
-
-       printf("Put the interface up\n");
-
-       err = nozzle_run_updown(nozzle, NOZZLE_PREUP, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_PREUP error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("preup output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       err = nozzle_set_up(nozzle);
-       if (err < 0) {
-               printf("Unable to put the interface up\n");
-               err = -1;
-               goto out_clean;
-       }
-       err = nozzle_run_updown(nozzle, NOZZLE_UP, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_UP error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("up output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-
-       printf("Put the interface down\n");
-
-       err = nozzle_run_updown(nozzle, NOZZLE_DOWN, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_DOWN error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("down output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       err = nozzle_set_down(nozzle);
-       if (err < 0) {
-               printf("Unable to put the interface down\n");
-               err = -1;
-               goto out_clean;
-       }
-       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_POSTDOWN error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("postdown output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-
-       nozzle_close(nozzle);
-
-       printf("Testing interface pre-up/up/down/post-down\n");
-
-       memset(device_name, 0, size);
-
-       nozzle = nozzle_open(device_name, size, ABSBUILDDIR "/nozzle_updown_good");
-       if (!nozzle) {
-               printf("Unable to init %s\n", device_name);
-               return -1;
-       }
-
-       printf("Put the interface up\n");
-
-       err = nozzle_run_updown(nozzle, NOZZLE_PREUP, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_PREUP error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("preup output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       err = nozzle_set_up(nozzle);
-       if (err < 0) {
-               printf("Unable to put the interface up\n");
-               err = -1;
-               goto out_clean;
-       }
-       err = nozzle_run_updown(nozzle, NOZZLE_UP, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_UP error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("up output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-
-       printf("Put the interface down\n");
-
-       err = nozzle_run_updown(nozzle, NOZZLE_DOWN, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_DOWN error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("down output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-       err = nozzle_set_down(nozzle);
-       if (err < 0) {
-               printf("Unable to put the interface down\n");
-               err = -1;
-               goto out_clean;
-       }
-       err = nozzle_run_updown(nozzle, NOZZLE_POSTDOWN, &error_string);
-       if (err) {
-               printf("nozzle_run_updown NOZZLE_POSTDOWN error: %s\n", strerror(errno));
-       }
-       if (error_string) {
-               printf("postdown output: %s\n", error_string);
-               free(error_string);
-               error_string = NULL;
-       }
-
-       nozzle_close(nozzle);
-
-       printf("Test ERROR conditions\n");
-
-       printf("Pass NULL to nozzle set_up\n");
-       err = 0;
-       errno = 0;
-       if ((nozzle_set_up(NULL) >= 0) || (errno != EINVAL)) {
-               printf("Something is wrong in nozzle_set_up sanity checks\n");
-               err = -1;
-               goto out_clean;
-       }
-
-       printf("Pass NULL to nozzle set_down\n");
-       errno = 0;
-       if ((nozzle_set_down(NULL) >= 0) || (errno != EINVAL)) {
-               printf("Something is wrong in nozzle_set_down sanity checks\n");
-               err = -1;
-               goto out_clean;
-       }
-
-out_clean:
-       nozzle_close(nozzle);
-
-       return err;
-}
-
 static int check_knet_set_del_ip(void)
 {
        char device_name[IFNAMSIZ];
@@ -468,9 +234,6 @@ int main(void)
 
        make_local_ips(testipv4_1, testipv4_2, testipv6_1, testipv6_2);
 
-       if (check_knet_up_down() < 0)
-               return -1;
-
        if (check_knet_set_del_ip() < 0)
                return -1;
 
diff --git a/libnozzle/tests/tap_updown_bad/down.d/kronostest b/libnozzle/tests/tap_updown_bad/down.d/kronostest
deleted file mode 100755 (executable)
index 721ecb6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 1
diff --git a/libnozzle/tests/tap_updown_bad/post-down.d/kronostest b/libnozzle/tests/tap_updown_bad/post-down.d/kronostest
deleted file mode 100755 (executable)
index 721ecb6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 1
diff --git a/libnozzle/tests/tap_updown_bad/pre-up.d/kronostest b/libnozzle/tests/tap_updown_bad/pre-up.d/kronostest
deleted file mode 100755 (executable)
index 721ecb6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 1
diff --git a/libnozzle/tests/tap_updown_bad/up.d/kronostest b/libnozzle/tests/tap_updown_bad/up.d/kronostest
deleted file mode 100755 (executable)
index 721ecb6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 1
diff --git a/libnozzle/tests/tap_updown_good/down.d/kronostest b/libnozzle/tests/tap_updown_good/down.d/kronostest
deleted file mode 100755 (executable)
index 6e28da1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 0
diff --git a/libnozzle/tests/tap_updown_good/post-down.d/kronostest b/libnozzle/tests/tap_updown_good/post-down.d/kronostest
deleted file mode 100755 (executable)
index 6e28da1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 0
diff --git a/libnozzle/tests/tap_updown_good/pre-up.d/kronostest b/libnozzle/tests/tap_updown_good/pre-up.d/kronostest
deleted file mode 100755 (executable)
index 6e28da1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 0
diff --git a/libnozzle/tests/tap_updown_good/up.d/kronostest b/libnozzle/tests/tap_updown_good/up.d/kronostest
deleted file mode 100755 (executable)
index 6e28da1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-exit 0