• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Alan-Jowett / ebpf-verifier / 20938922363

10 Jan 2026 05:49PM UTC coverage: 86.61% (+0.005%) from 86.605%
20938922363

push

github

elazarg
Bump external/bpf_conformance from `35b1eb1` to `3203c1f`

Bumps [external/bpf_conformance](https://github.com/Alan-Jowett/bpf_conformance) from `35b1eb1` to `3203c1f`.
- [Release notes](https://github.com/Alan-Jowett/bpf_conformance/releases)
- [Commits](https://github.com/Alan-Jowett/bpf_conformance/compare/35b1eb1bc...<a class=hub.com/Alan-Jowett/ebpf-verifier/commit/3203c1fa9863bd28b6d57c03433b834aa0556ad7">3203c1fa9)

---
updated-dependencies:
- dependency-name: external/bpf_conformance
  dependency-version: 3203c1fa9863bd28b6d57c03433b834aa0556ad7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

9023 of 10418 relevant lines covered (86.61%)

3906755.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.64
/src/test/conformance_check.cpp
1
// Copyright (c) Prevail Verifier contributors.
2
// SPDX-License-Identifier: MIT
3

4
// This program reads BPF instructions from stdin and memory contents from
5
// the first argument. It then executes the BPF program and prints the
6
// value of r0 at the end of execution.
7
// The program is intended to be used with the bpf conformance test suite.
8

9
#include <iostream>
10
#include <sstream>
11
#include <string>
12
#include <vector>
13

14
#include <CLI11/CLI11.hpp>
15

16
#include "ebpf_verifier.hpp"
17
#include "test/ebpf_yaml.hpp"
18

19
using namespace prevail;
20

21
/**
22
 * @brief Read in a string of hex bytes and return a vector of bytes.
23
 *
24
 * @param[in] input String containing hex bytes.
25
 * @return Vector of bytes.
26
 */
27
std::vector<std::byte> base16_decode(const std::string& input) {
888✔
28
    std::vector<std::byte> output;
888✔
29
    std::stringstream ss(input);
888✔
30
    std::string value;
888✔
31
    while (std::getline(ss, value, ' ')) {
57,032✔
32
        if (value.empty()) {
56,144✔
33
            continue;
28,072✔
34
        }
35
        try {
14,036✔
36
            output.push_back(static_cast<std::byte>(std::stoi(value, nullptr, 16)));
28,072✔
37
        } catch (std::invalid_argument&) {
×
38
            std::cerr << "base16_decode failed to decode " << value << "\n";
×
39
        } catch (std::out_of_range&) {
×
40
            std::cerr << "base16_decode failed to decode " << value << "\n";
×
41
        }
×
42
    }
43
    return output;
1,776✔
44
}
888✔
45

46
/**
47
 * @brief This program reads BPF instructions from stdin and memory contents from
48
 * the first argument. It then executes the BPF program and prints the
49
 * value of r0 at the end of execution.
50
 */
51
int main(int argc, char** argv) {
444✔
52
    CLI::App app{"Check conformance"};
1,110✔
53
    bool debug = false;
444✔
54
    app.add_flag("--debug", debug, "Debug");
1,110✔
55
    std::string memory_string;
444✔
56
    app.add_option("--memory,memory", memory_string, "base16 memory bytes");
1,110✔
57
    std::string program_string;
444✔
58
    app.add_option("--program", program_string, "base16 program bytes");
1,110✔
59
    std::string other_positional_argument;
444✔
60

61
    // Currently the conformance test project passes an empty string as an additional
62
    // positional argument. We need to accept it to make CLI11 parsing pass until
63
    // the test project is fixed.
64
    app.add_option("other", other_positional_argument, "Other");
1,110✔
65
    CLI11_PARSE(app, argc, argv);
444✔
66

67
    if (program_string.empty()) {
444✔
68
        std::getline(std::cin, program_string);
444✔
69
    }
70

71
    const auto& result = run_conformance_test_case(base16_decode(memory_string), base16_decode(program_string), debug);
444✔
72
    if (!result.success) {
444✔
73
        // Write failure reason to stdout since the bpf conformance library does not look at stderr.
74
        std::cout << "Verification failed\n";
2✔
75
        return 1;
1✔
76
    }
77
    if (result.r0_value.is_top()) {
442✔
78
        std::cout << "Couldn't determine r0 value\n";
4✔
79
        return 1;
2✔
80
    }
81
    if (!result.r0_value.singleton()) {
656✔
82
        std::cout << "r0 value is range [" << result.r0_value.lb() << ", " << result.r0_value.ub() << "]\n";
5✔
83
        return 1;
2✔
84
    }
85

86
    // Print output so the conformance test suite can check it.
87
    if (result.r0_value.singleton() && result.r0_value.singleton().value().fits_cast_to<int64_t>()) {
872✔
88
        std::cout << std::hex << result.r0_value.singleton().value().cast_to<uint64_t>() << std::endl;
872✔
89
    } else {
90
        std::cout << result.r0_value << std::endl;
222✔
91
    }
92

93
    return 0;
218✔
94
}
666✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc