blob: d1bbda2e94da2494d4b921dddee0afffd5da675c [file] [log] [blame]
#!/bin/bash
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### Test expected behavior of fx log
BT_FILE_DEPS=(
"scripts/fx"
"tools/devshell/contrib/ffx"
"tools/devshell/lib/fx-cmd-locator.sh"
"tools/devshell/lib/fx-optional-features.sh"
"tools/devshell/lib/generate-ssh-config.sh"
"tools/devshell/lib/updates.sh"
"tools/devshell/lib/vars.sh"
"tools/devshell/lib/platform.sh"
"tools/devshell/symbolize"
"tools/devshell/log"
)
BT_MOCKED_TOOLS=(
"tools/devshell/wait"
"tools/devshell/shell"
"tools/devshell/ssh"
)
declare fx ffx
BT_SET_UP() {
source "${BT_TEMP_DIR}/tools/devshell/tests/lib/fuchsia-mock.sh"
fx="$(btf::setup_fx)"
ffx="$(btf::make_hosttools_mock ffx)"
}
TEST_log_raw() {
BT_EXPECT ${fx} -d testing log --legacy --raw
BT_EXPECT_FILE_DOES_NOT_EXIST "${ffx}.mock_state" \
"ffx should not have been called when using fx log --raw"
}
TEST_log() {
BT_EXPECT ${fx} -d testing log --flag1 --flag2
source "${ffx}.mock_state"
BT_EXPECT_STRING_CONTAINS_SUBSTRING "${BT_MOCK_ARGS[@]}" "log --flag1 --flag2"
}
BT_RUN_TESTS "$@"