From 767d2344ae937ee00a0aefaeec870d3064c4f422 Mon Sep 17 00:00:00 2001 From: Arzhan Kinzhalin Date: Tue, 27 Feb 2018 15:49:24 -0800 Subject: [PATCH] Fix incorrect handling of unrecognized commands. Fixes #13. --- clrtrust | 2 +- test/unrecognized-cmd.bats | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 test/unrecognized-cmd.bats diff --git a/clrtrust b/clrtrust index 82f333e..bd65860 100755 --- a/clrtrust +++ b/clrtrust @@ -809,7 +809,7 @@ while [ $# -gt 0 ]; do shift continue ;; - ("generate"|"list"|"add"|"remove"|"restore"|"check") + (*) COMMAND=$1 shift ;; diff --git a/test/unrecognized-cmd.bats b/test/unrecognized-cmd.bats new file mode 100755 index 0000000..5d75c18 --- /dev/null +++ b/test/unrecognized-cmd.bats @@ -0,0 +1,20 @@ +#!/usr/bin/env bats +# Copyright 2017 Intel Corporation + +load test_lib + +setup() { + find_clrtrust + setup_fs +} + +@test "handle unrecognized command" { + run $CLRTRUST regenerate + [ $status -ne 0 ] +} + +teardown() { + remove_fs +} + +# vim: ft=sh:sw=4:ts=4:et:tw=80:si:noai:nocin