Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [pull_request]

jobs:
ci:
runs-on: ubuntu-latest
name: CI for Pull Request
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
path: src/src

- name: CI
uses: tedd-an/bzcafe@main
with:
task: ci
base_folder: src
space: user
github_token: ${{ secrets.ACTION_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

26 changes: 26 additions & 0 deletions .github/workflows/code_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Code Scan

on:
schedule:
- cron: "40 7 * * FRI"

jobs:
code-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout the source
uses: actions/checkout@v2
with:
fetch-depth: 0
path: src
- name: Code Scan
uses: BluezTestBot/action-code-scan@main
with:
src_path: src
github_token: ${{ secrets.GITHUB_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: scan_report
path: scan_report.tar.gz

43 changes: 43 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Sync

on:
schedule:
- cron: "*/30 * * * *"

jobs:
sync_repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master

- name: Sync Repo
uses: tedd-an/bzcafe@main
with:
task: sync
upstream_repo: 'https://git.kernel.org/pub/scm/bluetooth/bluez.git'
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup PR
uses: tedd-an/bzcafe@main
with:
task: cleanup
github_token: ${{ secrets.ACTION_TOKEN }}

sync_patchwork:
needs: sync_repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Sync Patchwork
uses: tedd-an/bzcafe@main
with:
task: patchwork
space: user
github_token: ${{ secrets.ACTION_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

39 changes: 39 additions & 0 deletions Makefile.tools
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ tools_l2cap_tester_SOURCES = tools/l2cap-tester.c tools/tester.h monitor/bt.h \
emulator/smp.c
tools_l2cap_tester_LDADD = lib/libbluetooth-internal.la \
src/libshared-glib.la $(GLIB_LIBS)
tools_l2cap_tester_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS)
nodist_tools_l2cap_tester_SOURCES =

tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
emulator/hciemu.h emulator/hciemu.c \
Expand Down Expand Up @@ -191,6 +193,8 @@ tools_sco_tester_SOURCES = tools/sco-tester.c tools/tester.h monitor/bt.h \
emulator/smp.c
tools_sco_tester_LDADD = lib/libbluetooth-internal.la \
src/libshared-glib.la $(GLIB_LIBS)
tools_sco_tester_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS)
nodist_tools_sco_tester_SOURCES =

tools_hci_tester_SOURCES = tools/hci-tester.c monitor/bt.h
tools_hci_tester_LDADD = src/libshared-glib.la $(GLIB_LIBS)
Expand All @@ -212,6 +216,8 @@ tools_iso_tester_SOURCES = tools/iso-tester.c tools/tester.h monitor/bt.h \
emulator/smp.c
tools_iso_tester_LDADD = lib/libbluetooth-internal.la \
src/libshared-glib.la $(GLIB_LIBS)
tools_iso_tester_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS)
nodist_tools_iso_tester_SOURCES =

tools_ioctl_tester_SOURCES = tools/ioctl-tester.c monitor/bt.h \
emulator/hciemu.h emulator/hciemu.c \
Expand All @@ -221,6 +227,39 @@ tools_ioctl_tester_SOURCES = tools/ioctl-tester.c monitor/bt.h \
emulator/smp.c
tools_ioctl_tester_LDADD = lib/libbluetooth-internal.la \
src/libshared-glib.la $(GLIB_LIBS)

if TESTING_BPF
tools/vmlinux.h: $(BPF_VMLINUX)
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
bpftool btf dump file $(BPF_VMLINUX) format c > $@.new && \
mv -f $@.new $@

tools/tester-bpf.o: $(srcdir)/tools/tester-bpf.c tools/vmlinux.h
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(CLANG_BPF) -Wall -Werror -Os -g --target=bpf -Itools -c -o $@ $<

tools/tester-skel.h: tools/tester-bpf.o
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
bpftool gen skeleton $< > $@.new && \
mv -f $@.new $@

BPF_BUILT_SOURCES = $(builddir)/tools/tester-skel.h $(builddir)/tools/vmlinux.h

nodist_tools_sco_tester_SOURCES += $(BPF_BUILT_SOURCES)
nodist_tools_iso_tester_SOURCES += $(BPF_BUILT_SOURCES)
nodist_tools_l2cap_tester_SOURCES += $(BPF_BUILT_SOURCES)
BUILT_SOURCES += $(BPF_BUILT_SOURCES)
CLEANFILES += $(BPF_BUILT_SOURCES)

tools_sco_tester_CPPFLAGS += -I$(builddir)/tools $(LIBBPF_CFLAGS)
tools_iso_tester_CPPFLAGS += -I$(builddir)/tools $(LIBBPF_CFLAGS)
tools_l2cap_tester_CPPFLAGS += -I$(builddir)/tools $(LIBBPF_CFLAGS)

tools_sco_tester_LDADD += $(LIBBPF_LIBS)
tools_iso_tester_LDADD += $(LIBBPF_LIBS)
tools_l2cap_tester_LDADD += $(LIBBPF_LIBS)
endif

endif

if TOOLS
Expand Down
36 changes: 32 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,38 @@ AC_ARG_ENABLE(testing, AS_HELP_STRING([--enable-testing],
AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")

if (test "${enable_testing}" = "yes"); then
AC_CHECK_DECLS([SOF_TIMESTAMPING_TX_COMPLETION, SCM_TSTAMP_COMPLETION],
[], [], [[#include <time.h>
#include <linux/errqueue.h>
#include <linux/net_tstamp.h>]])
AC_CHECK_DECLS([SOF_TIMESTAMPING_TX_COMPLETION, SCM_TSTAMP_COMPLETION],
[], [], [[#include <time.h>
#include <linux/errqueue.h>
#include <linux/net_tstamp.h>]])
fi

AC_ARG_ENABLE(testing-bpf, AS_HELP_STRING([--enable-testing-bpf[=PATH/TO/VMLINUX]],
[enable BPF testing tools]),
[enable_testing_bpf=yes; enable_testing_bpf_arg=${enableval}],
[enable_bpf=no])
AM_CONDITIONAL(TESTING_BPF, test "${enable_testing_bpf}" = "yes")

if (test "${enable_testing_bpf}" = "yes"); then
AC_ARG_VAR(CLANG_BPF, [CLANG compiler (for BPF)])
AC_ARG_VAR(BPFTOOL, [bpftool])
AC_ARG_VAR(BPF_VMLINUX, [vmlinux image to use for BPF testing])
AC_PATH_PROG([CLANG_BPF], [clang], "no")
if (test "${CLANG_BPF}" == "no"); then
AC_MSG_ERROR([clang for BPF missing])
fi
AC_PATH_PROG([BPFTOOL], [bpftool], "no")
if (test "${BPFTOOL}" == "no"); then
AC_MSG_ERROR([bpftool missing])
fi
PKG_CHECK_MODULES(LIBBPF, libbpf >= 1.4, [], [AC_MSG_ERROR([libbpf missing])])
if (test "${enable_testing_bpf_arg}" != "yes"); then
BPF_VMLINUX=${enable_testing_bpf_arg}
elif (test "${BPF_VMLINUX}" = ""); then
BPF_VMLINUX=/sys/kernel/btf/vmlinux
fi
AC_MSG_NOTICE([using BPF_VMLINUX=${BPF_VMLINUX} for BPF testing])
AC_DEFINE(HAVE_BPF, 1, [Define to 1 if bpf testing is required])
fi

AC_ARG_ENABLE(experimental, AS_HELP_STRING([--enable-experimental],
Expand Down
28 changes: 26 additions & 2 deletions doc/test-runner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ Bluetooth

CONFIG_UHID=y

Lock debuging
-------------
Lock debugging
--------------

To catch locking related issues the following set of kernel config
options may be useful:
Expand All @@ -110,6 +110,21 @@ options may be useful:
CONFIG_DEBUG_MUTEXES=y
CONFIG_KASAN=y

BPF testing
-----------

For BPF related tests:

.. code-block::

CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_BPF=y
CONFIG_DEBUG_INFO_DWARF5=y
CONFIG_DEBUG_INFO_BTF=y

EXAMPLES
========

Expand All @@ -127,6 +142,15 @@ Running a specific test of mgmt-tester

$ tools/test-runner -k /pathto/bzImage -- tools/mgmt-tester -s "<name>"

Compiling and running BPF tests
-------------------------------

.. code-block::

$ ./configure --enable-testing --enable-testing-bpf=/home/me/linux/vmlinux
$ make
$ tools/test-runner -k /home/me/linux/arch/x86_64/boot/bzImage -- tools/iso-tester -s BPF

Running bluetoothctl with emulated controller
---------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions doc/tester.config
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,11 @@ CONFIG_PROVE_RCU=y
CONFIG_LOCKDEP=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_KASAN=y

CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_BPF=y
CONFIG_DEBUG_INFO_DWARF5=y
CONFIG_DEBUG_INFO_BTF=y
Loading