X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Ftest-bundle.c;h=9a658396797fcbe246c596a21ff244bff6908e18;hb=003ce655b7116d18c86a74c50391e54990346931;hp=41e2e38e10986229dcdd09885f9acff89ad5ada7;hpb=bdda5aca7b376bcc8c88072d00011a9da04af65c;p=sliver-openvswitch.git diff --git a/tests/test-bundle.c b/tests/test-bundle.c index 41e2e38e1..9a6583967 100644 --- a/tests/test-bundle.c +++ b/tests/test-bundle.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, 2013 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. @@ -23,9 +23,9 @@ #include "flow.h" #include "ofp-actions.h" #include "ofpbuf.h" -#include "random.h" #include "util.h" +#include "ovstest.h" #define N_FLOWS 50000 #define MAX_SLAVES 8 /* Maximum supported by this test framework. */ @@ -79,7 +79,7 @@ parse_bundle_actions(char *actions) ovs_fatal(0, "%s", error); } - action = ofpacts.data; + action = ofpbuf_data(&ofpacts); bundle = ofpact_get_BUNDLE(xmemdup(action, action->len)); ofpbuf_uninit(&ofpacts); @@ -105,8 +105,8 @@ mask_str(uint8_t mask, size_t n_bits) return str; } -int -main(int argc, char *argv[]) +static void +test_bundle_main(int argc, char *argv[]) { bool ok = true; struct ofpact_bundle *bundle; @@ -116,7 +116,6 @@ main(int argc, char *argv[]) int old_active; set_program_name(argv[0]); - random_init(); if (argc != 2) { ovs_fatal(0, "usage: %s bundle_action", program_name); @@ -140,9 +139,7 @@ main(int argc, char *argv[]) /* 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); } @@ -268,5 +265,7 @@ main(int argc, char *argv[]) free(bundle); free(flows); - return ok ? 0 : 1; + exit(ok ? 0 : 1); } + +OVSTEST_REGISTER("test-bundle", test_bundle_main);