From 72c904cdedaa79eea800fe05a5cf5ad8e1c7ce96 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 28 Jun 2020 15:50:42 -0700 Subject: [PATCH] Test: Allow root CInema config --- src/platform/test/cinema-main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/platform/test/cinema-main.c b/src/platform/test/cinema-main.c index 74d15b62c..28a97a046 100644 --- a/src/platform/test/cinema-main.c +++ b/src/platform/test/cinema-main.c @@ -281,10 +281,13 @@ static void _loadConfigTree(struct Table* configTree, const char* testName) { mCoreConfigLoadPath(config, path); HashTableInsert(configTree, key, config); char* pos = strrchr(key, '.'); - if (!pos) { + if (pos) { + pos[0] = '\0'; + } else if (key[0]) { + key[0] = '\0'; + } else { break; } - pos[0] = '\0'; } } @@ -311,10 +314,13 @@ static const char* _lookupValue(struct Table* configTree, const char* testName, return str; } char* pos = strrchr(testKey, '.'); - if (!pos) { + if (pos) { + pos[0] = '\0'; + } else if (testKey[0]) { + testKey[0] = '\0'; + } else { break; } - pos[0] = '\0'; } return NULL; }