diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2008-02-05 14:02:38 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2008-02-05 14:02:38 -0330 |
commit | e4dadd4907bdc43f35f87a743fb6ba89df53257d (patch) | |
tree | b6928dfd4601a8e8d989661dc6a072483b23f39d /cpp | |
parent | Minor fix (diff) | |
download | ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.tar.bz2 ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.tar.xz ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.zip |
Bug 1373 - allowable property names in config files
Added continue to allDemos scripts
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/allDemos.py | 28 | ||||
-rw-r--r-- | cpp/include/IceUtil/StringUtil.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 73 | ||||
-rw-r--r-- | cpp/src/IceUtil/StringUtil.cpp | 15 | ||||
-rwxr-xr-x | cpp/src/Slice/Preprocessor.cpp | 9 |
5 files changed, 86 insertions, 44 deletions
diff --git a/cpp/allDemos.py b/cpp/allDemos.py index 98936c9d3cc..66cd79d559c 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -10,6 +10,9 @@ import os, sys, getopt, re +keepGoing = False +testErrors = [] + def isCygwin(): # The substring on sys.platform is required because some cygwin # versions return variations like "cygwin_nt-4.01". @@ -20,6 +23,8 @@ if sys.platform == "win32": sys.exit(1) def runDemos(args, demos, num = 0): + global testErrors + global keepGoing rootPath = "demo" if not os.path.exists(rootPath): @@ -51,8 +56,15 @@ def runDemos(args, demos, num = 0): if status: if(num > 0): print "[" + str(num) + "]", - print "test in " + dir + " failed with exit status", status, - sys.exit(status) + message = "demo in " + dir + " failed with exit status", status, + print message + if keepGoing == False: + print "exiting" + sys.exit(status) + else: + print " ** Error logged and will be displayed again when suite is completed **" + testErrors.append(message) + # # List of all basic demos. @@ -112,11 +124,13 @@ def usage(): print " --trace Run the demos with tracing enabled." print " --host=host Set --Ice.Default.Host=<host>." print " --mode=debug|release Run the demos with debug or release mode builds (win32 only)." + print " --continue Keep running when a demo fails." sys.exit(2) try: opts, args = getopt.getopt(sys.argv[1:], "lr:R:", [ - "filter=", "rfilter=", "start-after=", "start=", "loop", "fast", "trace", "debug", "host=", "mode="]) + "filter=", "rfilter=", "start-after=", "start=", "loop", "fast", "trace", "debug", "host=", "mode=", + "continue"]) except getopt.GetoptError: usage() @@ -136,6 +150,8 @@ arg = "" for o, a in opts: if o in ("-l", "--loop"): loop = True + elif o in ("-c", "--continue"): + keepGoing = True elif o in ("-r", "-R", "--filter", '--rfilter'): regexp = re.compile(a) if o in ("--rfilter", "-R"): @@ -165,3 +181,9 @@ if loop: num += 1 else: runDemos(arg, demos) + +if len(testErrors) > 0: + print "The following errors occurred:" + for x in testErrors: + print x + diff --git a/cpp/include/IceUtil/StringUtil.h b/cpp/include/IceUtil/StringUtil.h index b7859ec6946..351739cc311 100644 --- a/cpp/include/IceUtil/StringUtil.h +++ b/cpp/include/IceUtil/StringUtil.h @@ -35,6 +35,11 @@ ICE_UTIL_API bool unescapeString(const std::string&, std::string::size_type, std ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&); // +// Trim white space +// +ICE_UTIL_API std::string trim(const std::string&); + +// // If a single or double quotation mark is found at the start // position, then the position of the matching closing quote is // returned. If no quotation mark is found at the start position, then diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 94a8f0cf276..cc60f9bde79 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -406,49 +406,56 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co void Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& converter) { - const string delim = " \t\r\n"; string s = line; - string::size_type idx = s.find('#'); - if(idx != string::npos) - { - s.erase(idx); - } - - idx = s.find_last_not_of(delim); - if(idx != string::npos && idx + 1 < s.length()) - { - s.erase(idx + 1); - } - - string::size_type beg = s.find_first_not_of(delim); - if(beg == string::npos) + // + // Remove comments and unescape #'s + // + string::size_type idx = 0; + while((idx = s.find("#", idx)) != string::npos) { - return; + if(idx != 0 && s[idx - 1] == '\\') + { + s.erase(idx - 1, 1); + ++idx; + } + else + { + s.erase(idx); + break; + } } - - string::size_type end = s.find_first_of(delim + "=", beg); - if(end == string::npos) + + // + // Split key/value and unescape ='s + // + string::size_type split = string::npos; + idx = 0; + while((idx = s.find("=", idx)) != string::npos) { - return; + if(idx != 0 && s[idx - 1] == '\\') + { + s.erase(idx - 1, 1); + } + else if(split == string::npos) + { + split = idx; + } + ++idx; } - - string key = s.substr(beg, end - beg); - - end = s.find('=', end); - if(end == string::npos) + + if(split == 0 || split == string::npos) { + s = IceUtilInternal::trim(s); + if(s.length() != 0) + { + getProcessLogger()->warning("invalid config file entry: \"" + line + "\""); + } return; } - ++end; - string value; - beg = s.find_first_not_of(delim, end); - if(beg != string::npos) - { - end = s.length(); - value = s.substr(beg, end - beg); - } + string key = IceUtilInternal::trim(s.substr(0, split)); + string value = IceUtilInternal::trim(s.substr(split + 1, s.length() - split - 1)); if(converter) { diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index 62bd9e1f44d..54e1a1d6253 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -364,6 +364,21 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri return true; } +// +// Trim white space (" \t\r\n") +// +string +IceUtilInternal::trim(const string& s) +{ + const string delim = " \t\r\n"; + if(s.length() != 0) + { + string::size_type beg = s.find_first_not_of(delim); + string::size_type end = s.find_last_not_of(delim); + return s.substr(beg, end - beg + 1); + } + return s; +} // // If a single or double quotation mark is found at the start position, diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 7b3acd99500..869dc5ca760 100755 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -284,14 +284,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin while((end = unprocessed.find(".ice", pos)) != string::npos) { end += 4; - string file = unprocessed.substr(pos, end - pos); - - // - // Strip white space from the file name. - // - size_t b = file.find_first_not_of(" \t"); - size_t e = file.find_last_not_of(" \t"); - file = file.substr(b, e - b + 1); + string file = IceUtilInternal::trim(unprocessed.substr(pos, end - pos)); // // Normalize paths if not relative path. |