]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: fix filter comparison test
authorMaria Matejka <mq@ucw.cz>
Thu, 12 Dec 2019 14:42:29 +0000 (15:42 +0100)
committerMaria Matejka <mq@ucw.cz>
Thu, 12 Dec 2019 14:42:46 +0000 (15:42 +0100)
filter/filter_test.c

index 3abe095b7b4e0b7ab87082ac3623152224fe7ab2..7adc480fad46cfa8f313cc22fbe0127b21c28b47 100644 (file)
@@ -49,12 +49,6 @@ run_function(const void *arg)
   if (t->cmp)
     return t->result == f_same(t->fn, t->cmp);
 
-  if (!f_same(t->fn, t->fn)) {
-    bt_result = bt_suite_result = 0;
-    bt_log_suite_case_result(0, "The function doesn't compare to itself as the same");
-    return 0;
-  }
-
   linpool *tmp = lp_new_default(&root_pool);
   enum filter_return fret = f_eval(t->fn, tmp, NULL);
   rfree(tmp);
@@ -81,23 +75,29 @@ int
 main(int argc, char *argv[])
 {
   bt_init(argc, argv);
+
   bt_bird_init();
   
   bt_assert_hook = bt_assert_filter;
 
   struct config *c = NULL;
   struct parse_config_file_arg pcfa = { .cp = &c, .filename = BT_CONFIG_FILE };
+
   bt_test_suite_base(parse_config_file, "conf", (const void *) &pcfa, 0, 0, "parse config file");
+  bt_assert(c);
+
   bt_test_suite_base(parse_config_file, "reconf", (const void *) &pcfa, 0, 0, "reconfigure with the same file");
+  bt_assert(c);
 
-  bt_bird_cleanup();
+  struct symbol *s;
+  WALK_LIST(s, c->symbols)
+    if ((s->class == SYM_FUNCTION) || (s->class == SYM_FILTER))
+      bt_assert_msg((s->flags & SYM_FLAG_SAME), "Symbol %s same check", s->name);
 
-  if (c)
-  {
-    struct f_bt_test_suite *t;
-    WALK_LIST(t, c->tests)
-      bt_test_suite_base(run_function, t->fn_name, t, BT_FORKING, BT_TIMEOUT, "%s", t->dsc);
-  }
+  struct f_bt_test_suite *t;
+  WALK_LIST(t, c->tests)
+    bt_test_suite_base(run_function, t->fn_name, t, BT_FORKING, BT_TIMEOUT, "%s", t->dsc);
 
+  bt_bird_cleanup();
   return bt_exit_value();
 }