GithubHelp home page GithubHelp logo

run tests without adjusting rlimit about ebpf HOT 8 CLOSED

cilium avatar cilium commented on May 28, 2024
run tests without adjusting rlimit

from ebpf.

Comments (8)

florianl avatar florianl commented on May 28, 2024

Hi @eclipseo
Did you have a look at https://github.com/cilium/ebpf/blob/master/.semaphore/semaphore.yml? This file reflects the configuration for the CI/CD tests, that are triggered for every PR on this repository.

from ebpf.

lmb avatar lmb commented on May 28, 2024

@eclipseo can you give details on the error you're seeing? FWIW, failing to increase the rlimit should only result in a warning, not an error:

	err := unix.Setrlimit(8, &unix.Rlimit{
		Cur: math.MaxUint64,
		Max: math.MaxUint64,
	})
	if err != nil {
		fmt.Println("WARNING: Failed to adjust rlimit, tests may fail")
	}

from ebpf.

eclipseo avatar eclipseo commented on May 28, 2024

Here's what I get when I try running the tests:

Testing    in: /builddir/build/BUILD/ebpf-5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f/_build/src
         PATH: /builddir/build/BUILD/ebpf-5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/ebpf-5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X github.com/cilium/ebpf/version.commit=5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f -X github.com/cilium/ebpf/version=0 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: github.com/cilium/ebpf
github.com/cilium/ebpf
WARNING: Failed to adjust rlimit, tests may fail
--- FAIL: TestCollectionSpecRewriteMaps (0.00s)
    collection_test.go:149: can't test program: can't run test: operation not permitted
--- FAIL: TestLoadCollectionSpec (0.00s)
    --- FAIL: TestLoadCollectionSpec/loader-clang-6.0.elf (0.00s)
        elf_reader_test.go:76: map hash_map: map create: operation not permitted
    --- FAIL: TestLoadCollectionSpec/loader-clang-7.elf (0.00s)
        elf_reader_test.go:76: map hash_map: map create: operation not permitted
    --- FAIL: TestLoadCollectionSpec/loader-clang-8.elf (0.00s)
        elf_reader_test.go:76: map hash_map: map create: operation not permitted
    --- FAIL: TestLoadCollectionSpec/loader-clang-9.elf (0.00s)
        elf_reader_test.go:76: map array_of_hash_map: map create: operation not permitted
--- FAIL: TestLink (0.00s)
    linker_test.go:35: 	0: MovReg dst: r0 src: r1
        	1: Call -1 <my_func>
        	2: Exit
        my_func:
        	3: LdImmDW dst: r0 imm: 1337
        	5: Exit
        
    linker_test.go:41: can't load program: operation not permitted
--- FAIL: TestMap (0.00s)
    map_test.go:33: map create: operation not permitted
--- FAIL: TestMapClose (0.00s)
    map_test.go:72: map create: operation not permitted
--- FAIL: TestMapPin (0.00s)
    map_test.go:99: map create: operation not permitted
--- FAIL: TestMapQueue (0.00s)
    map_test.go:162: map create: operation not permitted
--- FAIL: TestMapInMap (0.00s)
    --- FAIL: TestMapInMap/ArrayOfMaps (0.00s)
        map_test.go:226: map create: operation not permitted
    --- FAIL: TestMapInMap/HashOfMaps (0.00s)
        map_test.go:226: map create: operation not permitted
--- FAIL: TestNewMapInMapFromFD (0.00s)
    map_test.go:287: map create: operation not permitted
--- FAIL: TestPerfEventArray (0.00s)
    map_test.go:309: Can't create perf event array from PerfEventArray(keySize=0, valueSize=0, maxEntries=0, flags=0): map create: operation not permitted
    map_test.go:309: Can't create perf event array from PerfEventArray(keySize=4, valueSize=0, maxEntries=0, flags=0): map create: operation not permitted
    map_test.go:309: Can't create perf event array from PerfEventArray(keySize=0, valueSize=4, maxEntries=0, flags=0): map create: operation not permitted
--- FAIL: TestMapInMapValueSize (0.00s)
    map_test.go:356: map create: operation not permitted
--- FAIL: TestIterateEmptyMap (0.00s)
panic: map create: operation not permitted [recovered]
	panic: map create: operation not permitted
goroutine 45 [running]:
testing.tRunner.func1.1(0x56096849c1e0, 0xc000170800)
	/usr/lib/golang/src/testing/testing.go:942 +0x3d2
testing.tRunner.func1(0xc000174000)
	/usr/lib/golang/src/testing/testing.go:945 +0x3fb
panic(0x56096849c1e0, 0xc000170800)
	/usr/lib/golang/src/runtime/panic.go:967 +0x161
github.com/cilium/ebpf.createHash(0xc00016d5f0)
	/builddir/build/BUILD/ebpf-5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f/_build/src/github.com/cilium/ebpf/map_test.go:879 +0xb9
github.com/cilium/ebpf.TestIterateEmptyMap(0xc000174000)
	/builddir/build/BUILD/ebpf-5d50e74ed36f0420ef5004e84ed2cdd3e739ad3f/_build/src/github.com/cilium/ebpf/map_test.go:374 +0x46
testing.tRunner(0xc000174000, 0x5609684c8c68)
	/usr/lib/golang/src/testing/testing.go:993 +0xde
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1044 +0x359
exit status 2
FAIL	github.com/cilium/ebpf	0.016s

from ebpf.

lmb avatar lmb commented on May 28, 2024

linker_test.go:41: can't load program: operation not permitted

This error happens because loading an XDP program requires root. I'd have to look at the map errors, but I suspect they happen for a similar reason.

In general, it's not possible to run the tests without root, because a lot of eBPF is gated behind CAP_SYS_ADMIN. Is that what you are trying to do? If yes, you might be able to work around this using run-tests.sh, as Florian pointed outed. That requires that you have access to KVM if you want tests to run in a reasonable amount of time.

from ebpf.

eclipseo avatar eclipseo commented on May 28, 2024

run-tests.sh requires network access which is not possible within our CI. Thanks anyway.

from ebpf.

florianl avatar florianl commented on May 28, 2024

Instead of calling run-tests.sh you maybe can take it as source to configure your CI/CD tests and provide the required sources locally?

from ebpf.

lmb avatar lmb commented on May 28, 2024

I'm open to fix run-tests.sh so that it works without network access if that is useful to you.

from ebpf.

lmb avatar lmb commented on May 28, 2024

I'm closing this issue for now, feel free to re-open it if necessary.

from ebpf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.