From fa3e8412864a92715c296c6ed5e3828dd4bb2205 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 17 Apr 2015 11:53:40 +1000 Subject: [PATCH] Create config file in merge_config_file Change If132a94e53545d9134859aa508da7b9819ede2f8 introduced a small regression; it added an "inidelete" which looks in the config file to delete rows. However, at least for the test-case, the config file isn't created yet. The end result is that the test fails but we don't notice. 2015-04-17 00:55:03.169 | merge_config_file test-multiline: sed: can't read test-multiline.conf: No such file or directory 2015-04-17 00:55:03.195 | OK So fix this up by creating the config-file if it isn't there. Also, add "-e" to the test file so we catch things like this in the future. Change-Id: I43a4ecc247f19cccf51d5931dfb687adbd23d6b1 --- inc/meta-config | 8 ++++++++ tests/test_meta_config.sh | 2 ++ 2 files changed, 10 insertions(+) diff --git a/inc/meta-config b/inc/meta-config index c8789bf816..e5f902d1dd 100644 --- a/inc/meta-config +++ b/inc/meta-config @@ -86,6 +86,14 @@ function merge_config_file { local matchgroup=$2 local configfile=$3 + # note, configfile might be a variable (note the iniset, etc + # created in the mega-awk below is "eval"ed too, so we just leave + # it alone. + local real_configfile=$(eval echo $configfile) + if [ ! -f $real_configfile ]; then + touch $real_configfile + fi + get_meta_section $file $matchgroup $configfile | \ $CONFIG_AWK_CMD -v configfile=$configfile ' BEGIN { diff --git a/tests/test_meta_config.sh b/tests/test_meta_config.sh index 3ec65bf9b0..a04c081854 100755 --- a/tests/test_meta_config.sh +++ b/tests/test_meta_config.sh @@ -8,6 +8,8 @@ TOP=$(cd $(dirname "$0")/.. && pwd) source $TOP/inc/ini-config source $TOP/inc/meta-config +set -e + # check_result() tests and reports the result values # check_result "actual" "expected" function check_result {