Giter Club home page Giter Club logo

Comments (6)

brendangregg avatar brendangregg commented on August 25, 2024

I'll paste some commands I've run to test various things in development. These can be put in the runtime test suite:

bpftrace -e 'BEGIN { @aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1; exit(); }'

bpftrace -e 'BEGIN { $x = -123; printf("%d %lld %lld\n", $x, $x, - $x); exit(); }'
bpftrace -e 'BEGIN { $x = -2; printf("%d\n", $x >= 0 ? 0 : - $x); exit();  }'

bpftrace -e 'kprobe:vfs_read { @ = count(); } interval:s:1 { print(@); clear(@); exit(); }'
bpftrace -e 'kprobe:vfs_read { @a = count(); } interval:s:1 { print(@a); clear(@a); exit(); }'
bpftrace -e 'kprobe:vfs_read { @ab = count(); } interval:s:1 { print(@ab); clear(@ab); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abc = count(); } interval:s:1 { print(@abc); clear(@abc); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcd = count(); } interval:s:1 { print(@abcd); clear(@abcd); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcde = count(); } interval:s:1 { print(@abcde); clear(@abcde); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdef = count(); } interval:s:1 { print(@abcdef); clear(@abcdef); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefg = count(); } interval:s:1 { print(@abcdefg); clear(@abcdefg); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefgh = count(); } interval:s:1 { print(@abcdefgh); clear(@abcdefgh); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefghi = count(); } interval:s:1 { print(@abcdefghi); clear(@abcdefghi); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefghij = count(); } interval:s:1 { print(@abcdefghij); clear(@abcdefghij); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefghijk = count(); } interval:s:1 { print(@abcdefghijk); clear(@abcdefghijk); exit(); }'
bpftrace -e 'kprobe:vfs_read { @abcdefghijkl = count(); } interval:s:1 { print(@abcdefghijkl); clear(@abcdefghijkl); exit(); }'

I'll keep adding here when I remember.

from bpftrace.

mmarchini avatar mmarchini commented on August 25, 2024

Maybe we should mark this as priority to help us identify regressions like #103 sooner?

Also, it would be nice to have a CI for the project :)

from bpftrace.

brendangregg avatar brendangregg commented on August 25, 2024

Yeah, I'd thought about making this priority. And please file a separate ticket for CI.

I'll keep adding one-liners here for the runtime test. Just something basic that can run a bunch of one-liners and see if they fail would be great. bcc has a test suite for running tools, I haven't looked into it to see if that's the same approach we want.

I suppose each one-liner can end with 'interval:ms:50 { exit(); }', to ensure it exits quickly.

from bpftrace.

brendangregg avatar brendangregg commented on August 25, 2024

More one-liners:

bpftrace -e 'tracepoint:syscalls:sys_enter_r* { @[name] = count(); }'
bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @ = count(); } interval:s:1 { print(@); clear(@); }'
bpftrace -e 'tracepoint:syscalls:sys_enter_open { @a = count(); } tracepoint:syscalls:sys_enter_open { @b = count(); }'

from bpftrace.

williangaspar avatar williangaspar commented on August 25, 2024

Should it run with the other tests or separated? The test suite takes about 20s to run.
Right now I'm running them with:

cd tests/python
sudo python -m unittest discover --pattern=*.py

from bpftrace.

ajor avatar ajor commented on August 25, 2024

I think it should have it's own separate way of running the tests as these new ones will require root and probably won't work in the CI

from bpftrace.

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.