| #!/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 klog |
| |
| |
| 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/klog" |
| ) |
| |
| declare fx loglistener ffx |
| |
| BT_SET_UP() { |
| source "${BT_TEMP_DIR}/tools/devshell/tests/lib/fuchsia-mock.sh" |
| fx="$(btf::setup_fx)" |
| loglistener="$(btf::make_installed_hosttools_mock loglistener)" |
| ffx="$(btf::make_hosttools_mock ffx)" |
| } |
| |
| TEST_klog_raw() { |
| BT_EXPECT ${fx} -d "testing" klog --raw |
| BT_EXPECT_FILE_DOES_NOT_EXIST "${ffx}.mock_state" \ |
| "ffx should not have been called when using fx klog --raw" |
| } |
| |
| TEST_klog() { |
| BT_EXPECT ${fx} -d "testing" klog |
| source "${ffx}.mock_state" |
| BT_EXPECT_STRING_CONTAINS_SUBSTRING "${BT_MOCK_ARGS[@]}" "debug symbolize" |
| } |
| |
| BT_RUN_TESTS "$@" |