Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137379778
D49039.id151365.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D49039.id151365.diff
View Options
diff --git a/contrib/kyua/engine/scheduler.cpp b/contrib/kyua/engine/scheduler.cpp
--- a/contrib/kyua/engine/scheduler.cpp
+++ b/contrib/kyua/engine/scheduler.cpp
@@ -1632,7 +1632,10 @@
if (user_config.is_set("unprivileged_user")) {
const passwd::user& user =
user_config.lookup< engine::user_node >("unprivileged_user");
+ // The property is duplicated using both ATF and Kyua naming styles
+ // for better UX.
props["unprivileged-user"] = user.name;
+ props["unprivileged_user"] = user.name;
}
return props;
diff --git a/contrib/kyua/engine/scheduler_test.cpp b/contrib/kyua/engine/scheduler_test.cpp
--- a/contrib/kyua/engine/scheduler_test.cpp
+++ b/contrib/kyua/engine/scheduler_test.cpp
@@ -1192,6 +1192,7 @@
config::properties_map exp_props;
exp_props["unprivileged-user"] = "nobody";
+ exp_props["unprivileged_user"] = "nobody";
exp_props["var1"] = "value 1";
ATF_REQUIRE_EQ(exp_props,
diff --git a/contrib/kyua/integration/cmd_test_test.sh b/contrib/kyua/integration/cmd_test_test.sh
--- a/contrib/kyua/integration/cmd_test_test.sh
+++ b/contrib/kyua/integration/cmd_test_test.sh
@@ -596,6 +596,48 @@
}
+utils_test_case config_unprivileged_user
+config_unprivileged_user_body() {
+ cat >"my-config" <<EOF
+syntax(2)
+unprivileged_user = "nobody"
+EOF
+ cat >Kyuafile <<EOF
+syntax(2)
+atf_test_program{name="config1", test_suite="suite1"}
+EOF
+ utils_cp_helper config config1
+
+ CONFIG_VAR_FILE="$(pwd)/cookie"; export CONFIG_VAR_FILE
+ if [ -f "${CONFIG_VAR_FILE}" ]; then
+ atf_fail "Cookie file already created; test case list may have gotten" \
+ "a bad configuration"
+ fi
+
+ CONFIG_VAR_NAME="unprivileged-user"; export CONFIG_VAR_NAME
+ atf_check -s exit:1 -o ignore -e ignore kyua -c my-config test config1
+ [ -f "${CONFIG_VAR_FILE}" ] || \
+ atf_fail "Cookie file not created; test case list did not get" \
+ "configuration variables"
+ value="$(cat "${CONFIG_VAR_FILE}")"
+ [ "${value}" = "nobody" ] || \
+ atf_fail "Invalid value (${value}) in cookie file; test case list did" \
+ "not get the correct configuration variables"
+
+ rm "${CONFIG_VAR_FILE}"
+
+ CONFIG_VAR_NAME="unprivileged_user"; export CONFIG_VAR_NAME
+ atf_check -s exit:1 -o ignore -e ignore kyua -c my-config test config1
+ [ -f "${CONFIG_VAR_FILE}" ] || \
+ atf_fail "Cookie file not created; test case list did not get" \
+ "configuration variables"
+ value="$(cat "${CONFIG_VAR_FILE}")"
+ [ "${value}" = "nobody" ] || \
+ atf_fail "Invalid value (${value}) in cookie file; test case list did" \
+ "not get the correct configuration variables"
+}
+
+
utils_test_case store_contents
store_contents_body() {
utils_install_stable_test_wrapper
@@ -1042,6 +1084,7 @@
atf_add_test_case only_load_used_test_programs
atf_add_test_case config_behavior
+ atf_add_test_case config_unprivileged_user
atf_add_test_case store_contents
atf_add_test_case results_file__ok
diff --git a/contrib/kyua/integration/helpers/config.cpp b/contrib/kyua/integration/helpers/config.cpp
--- a/contrib/kyua/integration/helpers/config.cpp
+++ b/contrib/kyua/integration/helpers/config.cpp
@@ -34,12 +34,16 @@
ATF_TEST_CASE(get_variable);
ATF_TEST_CASE_HEAD(get_variable)
{
+ const char* varname = ::getenv("CONFIG_VAR_NAME");
+ if (varname == NULL) {
+ varname = "the-variable";
+ }
const char* output = ::getenv("CONFIG_VAR_FILE");
if (output == NULL) {
- set_md_var("require.config", "the-variable");
+ set_md_var("require.config", varname);
} else {
- if (has_config_var("the-variable")) {
- atf::utils::create_file(output, get_config_var("the-variable") +
+ if (has_config_var(varname)) {
+ atf::utils::create_file(output, get_config_var(varname) +
std::string("\n"));
} else {
atf::utils::create_file(output, "NOT DEFINED\n");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 23, 10:39 PM (11 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26036393
Default Alt Text
D49039.id151365.diff (4 KB)
Attached To
Mode
D49039: kyua: Pass unprivileged user config prop to ATF using all known names
Attached
Detach File
Event Timeline
Log In to Comment