summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/cli.c
AgeCommit message (Expand)AuthorFilesLines
2019-05-17Tests: Raise exception if API cli_inband command fails.Paul Vinciguerra1-1/+2
2019-05-09add mactime plugin unit / code coverage testsDave Barach1-8/+19
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-1/+1
2019-02-20pg: remove no-recycle optionDamjan Marion1-5/+0
2019-02-09buffers: fix typoDamjan Marion1-1/+1
2019-02-06buffers: make buffer data size configurable from startup configDamjan Marion1-1/+1
2019-01-23pg: cli improvementKingwel Xie1-31/+70
2019-01-01buffers: remove unused codeDamjan Marion1-1/+1
2018-11-17pcap-based dispatch tracerDave Barach1-1/+1
2018-10-23c11 safe string handling supportDave Barach1-2/+2
2018-05-17Packet generator: preserve pcap file timestampsDave Barach1-0/+1
2017-02-22VPP-635: CLI Memory leak with invalid parameterBilly McFall1-10/+29
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+636
#bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <vlib/vlib.h>
#include <vppinfra/sparse_vec.h>

static clib_error_t *
test_sparse_vec_command_fn (vlib_main_t * vm,
			    unformat_input_t * input,
			    vlib_cli_command_t * cmd)
{
  /* A sparse vector ... */
  int *spv = 0;
  int i, c0, c1;
  u32 i0, i1;

  /* set one member */
  sparse_vec_validate (spv, 42)[0] = 0x4242;
  /* count how many times we can find it */
  c0 = 0;
  for (i = 0; i <= 0xffff; i++)
    {
      c0 += (sparse_vec_index (spv, i) != 0);
    }

  if (c0 != 1)
    vlib_cli_output (vm, "sparse_vec_index failed: c0 is %d != 1", c0);

  c0 = 0;
  c1 = 0;
  for (i = 0; i <= 0xffff; i++)
    {
      sparse_vec_index2 (spv, i, 0xffff ^ i, &i0, &i1);
      c0 += (i0 != 0);
      c1 += (i1 != 0);
    }

  if (c0 != 1)
    vlib_cli_output (vm, "sparse_vec_index2 failed: c0 is %d != 1", c0);
  if (c1 != 1)
    vlib_cli_output (vm, "sparse_vec_index2 failed: c1 is %d != 1", c1);

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (test_sparse_vec_command, static) =
{
  .path = "test sparse_vec",
  .short_help = "test sparse_vec",
  .function = test_sparse_vec_command_fn,
};
/* *INDENT-ON* */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */