From 797dde886edfbd1e6bddeecb7d3ad87fdca97ab6 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 27 May 2022 11:58:11 +0200 Subject: lbu: add test for lbu commit usage --- lbu.in | 8 ++++---- tests/lbu_test | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lbu.in b/lbu.in index ee9c360..3a94d36 100644 --- a/lbu.in +++ b/lbu.in @@ -418,7 +418,7 @@ usage_commit() { The environment variables can also be set in $LBU_CONF __EOF__ - exit 1 + exit $1 } cmd_commit() { @@ -434,11 +434,11 @@ cmd_commit() { if [ -z "$mnt" ]; then # find what media to use media="${1:-$LBU_MEDIA}" - [ -z "$media" ] && usage_commit + [ -z "$media" ] && usage_commit "1" >&2 - # mount media unles its already mounted + # mount media unless its already mounted mnt=/media/$media - [ -d "$mnt" ] || usage + [ -d "$mnt" ] || usage "1" >&2 mount_once_rw "$mnt" || die "failed to mount $mnt" fi diff --git a/tests/lbu_test b/tests/lbu_test index f393b86..9be325d 100755 --- a/tests/lbu_test +++ b/tests/lbu_test @@ -5,7 +5,9 @@ init_tests \ lbu_usage \ lbu_include_usage \ lbu_inc_usage \ - lbu_add_usage + lbu_add_usage \ + lbu_commit_usage \ + lbu_ci_usage lbu_usage_body() { test_usage lbu @@ -26,3 +28,15 @@ lbu_add_usage_body() { -e empty \ lbu add -h } + +lbu_commit_usage_body() { + test_usage "lbu commit" +} + +lbu_ci_usage_body() { + init_env + atf_check -s exit:0 \ + -o match:"usage: lbu commit" \ + -e empty \ + lbu ci -h +} -- cgit v1.2.3