2018-08-27 16:21:26 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2019-02-19 18:52:19 +00:00
|
|
|
* This source code is licensed in accordance with the terms specified in
|
|
|
|
* the LICENSE file found in the root directory of this source tree.
|
2018-08-27 16:21:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Sanity check integration test for system_controls
|
|
|
|
// Spec file: specs/posix/system_controls.table
|
|
|
|
|
|
|
|
#include <osquery/tests/integration/tables/helper.h>
|
|
|
|
|
|
|
|
namespace osquery {
|
2018-09-21 18:54:31 +00:00
|
|
|
namespace table_tests {
|
2018-08-31 13:49:51 +00:00
|
|
|
namespace {
|
2018-08-27 16:21:26 +00:00
|
|
|
|
2018-09-21 18:54:31 +00:00
|
|
|
class SystemControlsTest : public testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
|
|
|
setUpEnvironment();
|
|
|
|
}
|
|
|
|
};
|
2018-08-27 16:21:26 +00:00
|
|
|
|
2019-03-26 22:07:03 +00:00
|
|
|
TEST_F(SystemControlsTest, test_sanity) {
|
2018-08-31 13:49:51 +00:00
|
|
|
auto const rows = execute_query("select * from system_controls");
|
2019-09-26 03:35:15 +00:00
|
|
|
auto const row_map = ValidationMap{
|
2018-08-31 13:49:51 +00:00
|
|
|
{"name", NonEmptyString},
|
2018-09-21 18:54:31 +00:00
|
|
|
{"oid", NormalType},
|
2019-09-26 03:35:15 +00:00
|
|
|
{"subsystem",
|
|
|
|
SpecificValuesCheck{"",
|
|
|
|
"abi",
|
|
|
|
"debug",
|
|
|
|
"dev",
|
|
|
|
"fs",
|
|
|
|
"fscache",
|
|
|
|
"hw",
|
|
|
|
"kern",
|
|
|
|
"kernel",
|
|
|
|
"machdep",
|
|
|
|
"net",
|
|
|
|
"user",
|
|
|
|
"vfs",
|
|
|
|
"vm"}},
|
2018-08-31 13:49:51 +00:00
|
|
|
{"current_value", NormalType},
|
|
|
|
{"config_value", NormalType},
|
|
|
|
{"type",
|
|
|
|
SpecificValuesCheck{
|
|
|
|
"", "node", "int", "string", "quad", "opaque", "struct"}},
|
|
|
|
#ifdef __APPLE__
|
|
|
|
{"field_name", NormalType},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
validate_rows(rows, row_map);
|
2018-08-27 16:21:26 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 13:49:51 +00:00
|
|
|
} // namespace
|
2018-09-21 18:54:31 +00:00
|
|
|
} // namespace table_tests
|
2018-08-27 16:21:26 +00:00
|
|
|
} // namespace osquery
|