Add BPF-to-BPF and PC relative call tests (#2395)

This commit is contained in:
Jak May
2019-01-11 19:33:08 -08:00
committed by GitHub
parent 1724430489
commit e9a0b3a8f3
9 changed files with 226 additions and 162 deletions

View File

@@ -0,0 +1,16 @@
/**
* @brief test program that generates BPF PC relative call instructions
*/
#include <solana_sdk.h>
void __attribute__ ((noinline)) helper() {
sol_log(__func__);
}
extern bool entrypoint(const uint8_t *input) {
sol_log(__func__);
helper();
return true;
}

View File

@@ -1,11 +0,0 @@
#include <criterion/criterion.h>
#include "../src/bench_alu.c"
Test(bench_alu, sanity) {
uint64_t input[] = {500, 0};
cr_assert(entrypoint((uint8_t *) input));
cr_assert_eq(input[0], 500);
cr_assert_eq(input[1], 5);
}