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: 7 7 100.0 %
Date: 2025-01-08 12:08:44 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 :   fd_log_level_core_set(3); /* crash on warning log */
      21          18 :   return 0;
      22          18 : }
      23             : 
      24             : int
      25             : LLVMFuzzerTestOneInput( uchar const * data,
      26             :                         ulong         data_sz ) {
      27             : 
      28             :   if( data_sz>=16UL ) return -1;
      29             : 
      30             :   fd_compute_budget_program_state_t state[1] = {0};
      31             :   int ok = fd_compute_budget_program_parse( data, data_sz, state );
      32             :   if( !ok ) {
      33             :     FD_FUZZ_MUST_BE_COVERED;
      34             :     return 0;
      35             :   }
      36             : 
      37             :   FD_FUZZ_MUST_BE_COVERED;
      38             :   assert( state->compute_budget_instr_cnt > 0 );
      39             :   assert( state->compute_units <= FD_COMPUTE_BUDGET_MAX_CU_LIMIT );
      40             :   assert( state->heap_size % FD_COMPUTE_BUDGET_HEAP_FRAME_GRANULARITY == 0 );
      41             :   return 0;
      42             : }

Generated by: LCOV version 1.14