Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
remove the duplicate bats test with make tricks
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed Jun 4, 2024
1 parent b8e0f8e commit c2c0924
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ linux/
*.rpm
test/tls-perf
*pyc
test/*.bats
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,6 @@ minigun:
for i in `seq 1 100`; do curl \-4 -s localhost:8000/tls.c > /dev/null; echo $$?; done

tests:
KTLS_IN_USE=true envsubst '$$KTLS_IN_USE' < test/tests.bats.template > test/ktls.bats
KTLS_IN_USE=false envsubst '$$KTLS_IN_USE' < test/tests.bats.template > test/non-ktls.bats
./test/bats/bin/bats test/
68 changes: 0 additions & 68 deletions test/non-ktls.bats

This file was deleted.

5 changes: 3 additions & 2 deletions test/setup_suite.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

TEST_TAG=0.0.0

# Runs only once in the beginning of the suite
setup_suite() {
_install_setup_prerequisits
Expand All @@ -19,7 +21,6 @@ _install_setup_prerequisits() {
}

_build_and_install_camblet_with_dkms() {
TEST_TAG=0.0.0
sudo cp -r . /usr/src/camblet-$TEST_TAG/
sudo dkms add -m camblet -v $TEST_TAG
if sudo dkms build -m camblet -v $TEST_TAG; then
Expand Down Expand Up @@ -65,7 +66,7 @@ teardown_suite() {
_teardown_file_server_build
_teardown_flags
_teardown_sockopt
sudo dkms remove camblet/$TEST_TAG
sudo dkms remove camblet/$TEST_TAG --all
sudo rm -rf /usr/src/camblet-$TEST_TAG/
}

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setup_file() {


_run_kernel_modul() {
if $ktls_in_use; then
if [[ $ktls_in_use = "true" ]]; then
echo '# Running tests with ktls' >&3
sudo modprobe tls
sudo modprobe camblet dyndbg==_ ktls_available=1
Expand Down
8 changes: 4 additions & 4 deletions test/ktls.bats → test/tests.bats.template
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ktls_in_use=true;
ktls_in_use=${KTLS_IN_USE}

load 'test_helper/bats-support/load.bash'
load 'test_helper/bats-assert/load.bash'
load 'test_helper/common.bash'

@test "Test if the ktls enabled kernel modul is in use" {
@test "Test if the ktls enabled kernel module is in use" {
run cat /sys/module/camblet/parameters/ktls_available
assert_output 'Y'
assert_output $([ $ktls_in_use = "true" ] && echo 'Y' || echo 'N')
}

@test "Test a normal directory listing with wget" {
Expand Down Expand Up @@ -65,4 +65,4 @@ load 'test_helper/common.bash'

@test "Test various recv flag parameters" {
./flags
}
}

0 comments on commit c2c0924

Please sign in to comment.