CloudNativeDataPlane / cndp

Cloud Native Data Plane (CNDP) is a collection of user space libraries to accelerate packet processing for cloud applications using AF_XDP sockets as the primary I/O..
BSD 3-Clause "New" or "Revised" License
90 stars 32 forks source link

rust unit tests failing #291

Open maryamtahhan opened 1 year ago

maryamtahhan commented 1 year ago

Following the instructions for the rust APIs through the readme allows for a successful build of those APIs but the unit tests seem to be failing when running the ./run_cne_test.sh script :

running 8 tests
test tests::test_register ... ok
test tests::test_load_config ... FAILED
test tests::test_get_port ... FAILED
test tests::test_get_port_details ... FAILED
test tests::test_cne_instance ... FAILED
test tests::test_loopback ... FAILED
test tests::test_rx_burst ... FAILED
test tests::test_tx_burst ... FAILED

failures:

---- tests::test_load_config stdout ----
thread 'tests::test_load_config' panicked at 'assertion failed: cfg.is_ok()', apis/cne/src/lib.rs:80:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- tests::test_get_port stdout ----
thread 'tests::test_get_port' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:118:9

---- tests::test_get_port_details stdout ----
thread 'tests::test_get_port_details' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:152:9

---- tests::test_cne_instance stdout ----
thread 'tests::test_cne_instance' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:99:9

---- tests::test_loopback stdout ----
thread 'tests::test_loopback' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:282:9

---- tests::test_rx_burst stdout ----
thread 'tests::test_rx_burst' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:180:9

---- tests::test_tx_burst stdout ----
thread 'tests::test_tx_burst' panicked at 'assertion failed: ret.is_ok()', apis/cne/src/lib.rs:233:9

failures:
    tests::test_cne_instance
    tests::test_get_port
    tests::test_get_port_details
    tests::test_load_config
    tests::test_loopback
    tests::test_rx_burst
    tests::test_tx_burst

test result: FAILED. 1 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass `-p cndp-cne --lib`
manojgop commented 1 year ago

@maryamtahhan Are you seeing this issue in fedora or ubuntu . I'm able to run units sets successfully in ubuntu 22.04.

ok
test tests::test_get_port ... libbpf: Kernel error message: Can't replace active BPF XDP link
libbpf: Kernel error message: Can't replace active BPF XDP link
ok
test tests::test_get_port_details ... libbpf: Kernel error message: Can't replace active BPF XDP link
libbpf: Kernel error message: Can't replace active BPF XDP link
ok
test tests::test_load_config ... ok
test tests::test_loopback ... libbpf: Kernel error message: Can't replace active BPF XDP link
libbpf: Kernel error message: Can't replace active BPF XDP link
ok
test tests::test_register ... ok
test tests::test_rx_burst ... libbpf: Kernel error message: Can't replace active BPF XDP link
libbpf: Kernel error message: Can't replace active BPF XDP link
ok
test tests::test_tx_burst ... libbpf: Kernel error message: Can't replace active BPF XDP link
libbpf: Kernel error message: Can't replace active BPF XDP link
ok

successes:

---- tests::test_get_port stdout ----
[2023-05-25T12:20:45Z DEBUG cne::tests] CneError::PortError(Port 100 is not configured)

---- tests::test_loopback stdout ----
[2023-05-25T12:20:49Z DEBUG cne::tests] Number of packets read = 0

---- tests::test_tx_burst stdout ----
[2023-05-25T12:20:52Z DEBUG cne::tests] Number of packets sent = 256

successes:
    tests::test_cne_instance
    tests::test_get_port
    tests::test_get_port_details
    tests::test_load_config
    tests::test_loopback
    tests::test_register
    tests::test_rx_burst
    tests::test_tx_burst

test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 9.83s
manojgop commented 1 year ago

I'm running these test from lang/rs/apis/cne directory. Just to confirm - Did you set LD_LIBRARY_PATH.
Append LD_LIBRARY_PATH environment variable with CNDP library path.

Ubuntu: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu Fedora: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64