LCOV - code coverage report
Current view: top level - ballet/pack - fuzz_compute_budget_program_parse.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 6 6 100.0 %
Date: 2024-11-13 11:58:15 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #if !FD_HAS_HOSTED
       2             : #error "This target requires FD_HAS_HOSTED"
       3             : #endif
       4             : 
       5             : #include <assert.h>
       6             : #include <stdio.h>
       7             : #include <stdlib.h>
       8             : 
       9             : #include "../../util/fd_util.h"
      10             : #include "../../util/sanitize/fd_fuzz.h"
      11             : #include "fd_compute_budget_program.h"
      12             : 
      13             : int
      14             : LLVMFuzzerInitialize( int  *   argc,
      15          18 :                       char *** argv ) {
      16             :   /* Set up shell without signal handlers */
      17          18 :   putenv( "FD_LOG_BACKTRACE=0" );
      18          18 :   fd_boot( argc, argv );
      19          18 :   atexit( fd_halt );
      20          18 :   return 0;
      21          18 : }
      22             : 
      23             : int
      24             : LLVMFuzzerTestOneInput( uchar const * data,
      25             :                         ulong         data_sz ) {
      26             : 
      27             :   if( data_sz>=16UL ) return -1;
      28             : 
      29             :   fd_compute_budget_program_state_t state[1] = {0};
      30             :   int ok = fd_compute_budget_program_parse( data, data_sz, state );
      31             :   if( !ok ) {
      32             :     FD_FUZZ_MUST_BE_COVERED;
      33             :     return 0;
      34             :   }
      35             : 
      36             :   FD_FUZZ_MUST_BE_COVERED;
      37             :   assert( state->compute_budget_instr_cnt > 0 );
      38             :   assert( state->compute_units <= FD_COMPUTE_BUDGET_MAX_CU_LIMIT );
      39             :   assert( state->heap_size % FD_COMPUTE_BUDGET_HEAP_FRAME_GRANULARITY == 0 );
      40             :   return 0;
      41             : }

Generated by: LCOV version 1.14