git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto: Inline trivial functions.
[sliver-openvswitch.git]
/
tests
/
test-bundle.c
diff --git
a/tests/test-bundle.c
b/tests/test-bundle.c
index
0e7525c
..
9a65839
100644
(file)
--- a/
tests/test-bundle.c
+++ b/
tests/test-bundle.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2011, 2012 Nicira, Inc.
+/* Copyright (c) 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-23,9
+23,9
@@
#include "flow.h"
#include "ofp-actions.h"
#include "ofpbuf.h"
#include "flow.h"
#include "ofp-actions.h"
#include "ofpbuf.h"
-#include "random.h"
#include "util.h"
#include "util.h"
+#include "ovstest.h"
#define N_FLOWS 50000
#define MAX_SLAVES 8 /* Maximum supported by this test framework. */
#define N_FLOWS 50000
#define MAX_SLAVES 8 /* Maximum supported by this test framework. */
@@
-71,10
+71,15
@@
parse_bundle_actions(char *actions)
struct ofpact_bundle *bundle;
struct ofpbuf ofpacts;
struct ofpact *action;
struct ofpact_bundle *bundle;
struct ofpbuf ofpacts;
struct ofpact *action;
+ char *error;
ofpbuf_init(&ofpacts, 0);
ofpbuf_init(&ofpacts, 0);
- bundle_parse_load(actions, &ofpacts);
- action = ofpacts.data;
+ error = bundle_parse_load(actions, &ofpacts);
+ if (error) {
+ ovs_fatal(0, "%s", error);
+ }
+
+ action = ofpbuf_data(&ofpacts);
bundle = ofpact_get_BUNDLE(xmemdup(action, action->len));
ofpbuf_uninit(&ofpacts);
bundle = ofpact_get_BUNDLE(xmemdup(action, action->len));
ofpbuf_uninit(&ofpacts);
@@
-100,8
+105,8
@@
mask_str(uint8_t mask, size_t n_bits)
return str;
}
return str;
}
-int
-main(int argc, char *argv[])
+static void
+
test_bundle_
main(int argc, char *argv[])
{
bool ok = true;
struct ofpact_bundle *bundle;
{
bool ok = true;
struct ofpact_bundle *bundle;
@@
-111,7
+116,6
@@
main(int argc, char *argv[])
int old_active;
set_program_name(argv[0]);
int old_active;
set_program_name(argv[0]);
- random_init();
if (argc != 2) {
ovs_fatal(0, "usage: %s bundle_action", program_name);
if (argc != 2) {
ovs_fatal(0, "usage: %s bundle_action", program_name);
@@
-135,9
+139,7
@@
main(int argc, char *argv[])
/* Generate flows. */
flows = xmalloc(N_FLOWS * sizeof *flows);
for (i = 0; i < N_FLOWS; i++) {
/* Generate flows. */
flows = xmalloc(N_FLOWS * sizeof *flows);
for (i = 0; i < N_FLOWS; i++) {
- random_bytes(&flows[i], sizeof flows[i]);
- memset(flows[i].zeros, 0, sizeof flows[i].zeros);
- flows[i].mpls_depth = 0;
+ flow_random_hash_fields(&flows[i]);
flows[i].regs[0] = ofp_to_u16(OFPP_NONE);
}
flows[i].regs[0] = ofp_to_u16(OFPP_NONE);
}
@@
-263,5
+265,7
@@
main(int argc, char *argv[])
free(bundle);
free(flows);
free(bundle);
free(flows);
-
return ok ? 0 : 1
;
+
exit(ok ? 0 : 1)
;
}
}
+
+OVSTEST_REGISTER("test-bundle", test_bundle_main);