LCOV - code coverage report
Current view: top level - plugins/ioam/lib-trace - trace_test.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 0 35 0.0 %
Date: 2023-07-05 22:20:52 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Cisco and/or its affiliates.
       3             :  * Licensed under the Apache License, Version 2.0 (the "License");
       4             :  * you may not use this file except in compliance with the License.
       5             :  * You may obtain a copy of the License at:
       6             :  *
       7             :  *     http://www.apache.org/licenses/LICENSE-2.0
       8             :  *
       9             :  * Unless required by applicable law or agreed to in writing, software
      10             :  * distributed under the License is distributed on an "AS IS" BASIS,
      11             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             :  * See the License for the specific language governing permissions and
      13             :  * limitations under the License.
      14             :  */
      15             : /*
      16             :  *------------------------------------------------------------------
      17             :  * trace_test.c - test harness for trace plugin
      18             :  *------------------------------------------------------------------
      19             :  */
      20             : 
      21             : #include <vat/vat.h>
      22             : #include <vlibapi/api.h>
      23             : #include <vlibmemory/api.h>
      24             : 
      25             : #include <vppinfra/error.h>
      26             : 
      27             : #define __plugin_msg_base trace_test_main.msg_id_base
      28             : #include <vlibapi/vat_helper_macros.h>
      29             : 
      30             : /* Declare message IDs */
      31             : #include <ioam/lib-trace/trace.api_enum.h>
      32             : #include <ioam/lib-trace/trace.api_types.h>
      33             : 
      34             : typedef struct
      35             : {
      36             :   /* API message ID base */
      37             :   u16 msg_id_base;
      38             :   vat_main_t *vat_main;
      39             : } trace_test_main_t;
      40             : 
      41             : trace_test_main_t trace_test_main;
      42             : 
      43             : static int
      44           0 : api_trace_profile_add (vat_main_t * vam)
      45             : {
      46           0 :   unformat_input_t *input = vam->input;
      47             :   vl_api_trace_profile_add_t *mp;
      48           0 :   u8 trace_type = 0;
      49           0 :   u8 num_elts = 0;
      50           0 :   u32 node_id = 0;
      51           0 :   u32 app_data = 0;
      52           0 :   u8 trace_tsp = 0;
      53             :   int ret;
      54             : 
      55           0 :   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
      56             :     {
      57           0 :       if (unformat (input, "trace-type 0x%x", &trace_type))
      58             :         ;
      59           0 :       else if (unformat (input, "trace-elts %d", &num_elts))
      60             :         ;
      61           0 :       else if (unformat (input, "trace-tsp %d", &trace_tsp))
      62             :         ;
      63           0 :       else if (unformat (input, "node-id 0x%x", &node_id))
      64             :         ;
      65           0 :       else if (unformat (input, "app-data 0x%x", &app_data))
      66             :         ;
      67             : 
      68             :       else
      69           0 :         break;
      70             :     }
      71             : 
      72             : 
      73           0 :   M (TRACE_PROFILE_ADD, mp);
      74             : 
      75           0 :   mp->trace_type = trace_type;
      76           0 :   mp->trace_tsp = trace_tsp;
      77           0 :   mp->node_id = htonl (node_id);
      78           0 :   mp->app_data = htonl (app_data);
      79           0 :   mp->num_elts = num_elts;
      80             : 
      81           0 :   S (mp);
      82           0 :   W (ret);
      83           0 :   return ret;
      84             : }
      85             : 
      86             : 
      87             : 
      88             : static int
      89           0 : api_trace_profile_del (vat_main_t * vam)
      90             : {
      91             :   vl_api_trace_profile_del_t *mp;
      92             :   int ret;
      93             : 
      94           0 :   M (TRACE_PROFILE_DEL, mp);
      95           0 :   S (mp);
      96           0 :   W (ret);
      97           0 :   return ret;
      98             : }
      99             : 
     100             : static int
     101           0 : api_trace_profile_show_config (vat_main_t * vam)
     102             : {
     103             :   vl_api_trace_profile_show_config_t *mp;
     104             :   int ret;
     105             : 
     106           0 :   M (TRACE_PROFILE_SHOW_CONFIG, mp);
     107           0 :   S (mp);
     108           0 :   W (ret);
     109           0 :   return ret;
     110             : }
     111             : 
     112             : static int
     113           0 : vl_api_trace_profile_show_config_reply_t_handler (vat_main_t * vam)
     114             : {
     115           0 :   return -1;
     116             : }
     117             : 
     118             : /* Override generated plugin register symbol */
     119             : #define vat_plugin_register trace_vat_plugin_register
     120             : #include <ioam/lib-trace/trace.api_test.c>
     121             : 
     122             : /*
     123             :  * fd.io coding-style-patch-verification: ON
     124             :  *
     125             :  * Local Variables:
     126             :  * eval: (c-set-style "gnu")
     127             :  * End:
     128             :  */

Generated by: LCOV version 1.14