Reformat test.sh

reviewable/pr132/r1
Tamir Duberstein 3 months ago
parent 0c8fb43804
commit 89eb550856

@ -3,50 +3,57 @@
set -eux set -eux
TEMPLATE_DIR=$1 TEMPLATE_DIR=$1
if [ -z "${TEMPLATE_DIR}" ]; then echo "template dir required"; exit 1; fi if [ -z "${TEMPLATE_DIR}" ]; then
echo "template dir required"
exit 1
fi
PROG_TYPE=$2 PROG_TYPE=$2
if [ -z "${PROG_TYPE}" ]; then echo "program type required"; exit 1; fi if [ -z "${PROG_TYPE}" ]; then
echo "program type required"
exit 1
fi
CRATE_NAME=aya-test-crate CRATE_NAME=aya-test-crate
case "${PROG_TYPE}" in case "${PROG_TYPE}" in
"cgroup_sockopt") "cgroup_sockopt")
ADDITIONAL_ARGS=(-d sockopt_target=getsockopt) ADDITIONAL_ARGS=(-d sockopt_target=getsockopt)
;; ;;
"classifier"|"cgroup_skb") "classifier" | "cgroup_skb")
ADDITIONAL_ARGS=(-d direction=Ingress) ADDITIONAL_ARGS=(-d direction=Ingress)
;; ;;
"fentry"|"fexit") "fentry" | "fexit")
ADDITIONAL_ARGS=(-d fn_name=try_to_wake_up) ADDITIONAL_ARGS=(-d fn_name=try_to_wake_up)
;; ;;
"kprobe"|"kretprobe") "kprobe" | "kretprobe")
ADDITIONAL_ARGS=(-d kprobe=do_unlinkat) ADDITIONAL_ARGS=(-d kprobe=do_unlinkat)
;; ;;
"lsm") "lsm")
ADDITIONAL_ARGS=(-d lsm_hook=file_open) ADDITIONAL_ARGS=(-d lsm_hook=file_open)
;; ;;
"raw_tracepoint") "raw_tracepoint")
ADDITIONAL_ARGS=(-d tracepoint_name=sys_enter) ADDITIONAL_ARGS=(-d tracepoint_name=sys_enter)
;; ;;
"sk_msg") "sk_msg")
ADDITIONAL_ARGS=(-d sock_map=SOCK_MAP) ADDITIONAL_ARGS=(-d sock_map=SOCK_MAP)
;; ;;
"tp_btf") "tp_btf")
ADDITIONAL_ARGS=(-d tracepoint_name=net_dev_queue) ADDITIONAL_ARGS=(-d tracepoint_name=net_dev_queue)
;; ;;
"tracepoint") "tracepoint")
ADDITIONAL_ARGS=(-d tracepoint_category=net -d tracepoint_name=net_dev_queue) ADDITIONAL_ARGS=(-d tracepoint_category=net -d tracepoint_name=net_dev_queue)
;; ;;
"uprobe"|"uretprobe") "uprobe" | "uretprobe")
ADDITIONAL_ARGS=(-d uprobe_target=/proc/self/exe -d uprobe_fn_name=main) ADDITIONAL_ARGS=(-d uprobe_target=/proc/self/exe -d uprobe_fn_name=main)
;; ;;
*) *)
ADDITIONAL_ARGS=() ADDITIONAL_ARGS=()
;;
esac esac
TMP_DIR=$(mktemp -d) TMP_DIR=$(mktemp -d)
clean_up() { clean_up() {
# shellcheck disable=SC2317 # shellcheck disable=SC2317
rm -rf "${TMP_DIR}" rm -rf "${TMP_DIR}"
} }
trap clean_up EXIT trap clean_up EXIT
@ -64,7 +71,7 @@ cargo build --package "${CRATE_NAME}" --release
cargo clippy --exclude "${CRATE_NAME}-ebpf" --all-targets --workspace -- --deny warnings cargo clippy --exclude "${CRATE_NAME}-ebpf" --all-targets --workspace -- --deny warnings
cargo clippy --package "${CRATE_NAME}-ebpf" --all-targets -- --deny warnings cargo clippy --package "${CRATE_NAME}-ebpf" --all-targets -- --deny warnings
expect << EOF expect <<EOF
set timeout 30 ;# Increase timeout if necessary set timeout 30 ;# Increase timeout if necessary
spawn cargo xtask run spawn cargo xtask run
expect { expect {

Loading…
Cancel
Save