/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "packets.h"
#include "random.h"
#include "unaligned.h"
-
+#include "ovstest.h"
#undef NDEBUG
#include <assert.h>
struct test_rule *rule, *next_rule;
struct cls_cursor cursor;
- ovs_rwlock_wrlock(&cls->rwlock);
+ fat_rwlock_wrlock(&cls->rwlock);
cls_cursor_init(&cursor, cls, NULL);
CLS_CURSOR_FOR_EACH_SAFE (rule, next_rule, cls_rule, &cursor) {
classifier_remove(cls, &rule->cls_rule);
free_rule(rule);
}
- ovs_rwlock_unlock(&cls->rwlock);
+ fat_rwlock_unlock(&cls->rwlock);
classifier_destroy(cls);
}
struct tcls tcls;
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields, ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
assert(classifier_is_empty(&cls));
assert(tcls_is_empty(&tcls));
compare_classifiers(&cls, &tcls);
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
classifier_destroy(&cls);
tcls_destroy(&tcls);
}
hash_bytes(&wc_fields, sizeof wc_fields, 0), 0);
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields,
ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
compare_classifiers(&cls, &tcls);
free_rule(rule);
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
classifier_destroy(&cls);
tcls_destroy(&tcls);
}
rule2->aux += 5;
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields,
ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
check_tables(&cls, 1, 1, 0);
compare_classifiers(&cls, &tcls);
tcls_destroy(&tcls);
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
destroy_classifier(&cls);
}
}
}
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields,
ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
compare_classifiers(&cls, &tcls);
}
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
classifier_destroy(&cls);
tcls_destroy(&tcls);
} while ((1 << count_ones(value_mask)) < N_RULES);
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields,
ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
compare_classifiers(&cls, &tcls);
}
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
classifier_destroy(&cls);
tcls_destroy(&tcls);
}
shuffle(priorities, ARRAY_SIZE(priorities));
classifier_init(&cls, flow_segment_u32s);
- ovs_rwlock_wrlock(&cls.rwlock);
+ fat_rwlock_wrlock(&cls.rwlock);
classifier_set_prefix_fields(&cls, trie_fields,
ARRAY_SIZE(trie_fields));
tcls_init(&tcls);
free_rule(target);
}
- ovs_rwlock_unlock(&cls.rwlock);
+ fat_rwlock_unlock(&cls.rwlock);
destroy_classifier(&cls);
tcls_destroy(&tcls);
}
/* Miniflow and minimask tests. */
{"miniflow", 0, 0, test_miniflow},
- {"minimask_has_extra", 0, 0, test_minimask_has_extra},
- {"minimask_combine", 0, 0, test_minimask_combine},
+ {"minimask_has_extra", 0, 0, test_minimask_has_extra},
+ {"minimask_combine", 0, 0, test_minimask_combine},
{NULL, 0, 0, NULL},
};
-int
-main(int argc, char *argv[])
+static void
+test_classifier_main(int argc, char *argv[])
{
set_program_name(argv[0]);
init_values();
run_command(argc - 1, argv + 1, commands);
- return 0;
}
+
+OVSTEST_REGISTER("test-classifier", test_classifier_main);