summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
blob: e3344fb4106ef4f1c8713126e982402ad7651cc8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/child_process.h>

using vespalib::ChildProcess;

TEST("no arguments") {
    ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache");
    drop.wait();
    EXPECT_EQUAL(1, drop.getExitCode());
}

TEST("file does not exist") {
    ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache not_exist");
    drop.wait();
    EXPECT_EQUAL(2, drop.getExitCode());
}

TEST("All is well") {
    ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache vespalib_drop_file_from_cache_test_app");
    drop.wait();
    EXPECT_EQUAL(0, drop.getExitCode());
}

TEST_MAIN_WITH_PROCESS_PROXY() { TEST_RUN_ALL(); }