Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 1 | // A basic unit test that runs on a BMC (qemu or hardware) |
| 2 | |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 3 | #include <getopt.h> |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 4 | #include <systemd/sd-journal.h> |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 5 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 6 | #include <phosphor-logging/elog-errors.hpp> |
Saqib Khan | 2bb1519 | 2017-02-13 13:19:55 -0600 | [diff] [blame] | 7 | #include <phosphor-logging/elog.hpp> |
| 8 | #include <phosphor-logging/log.hpp> |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 9 | #include <sdbusplus/exception.hpp> |
Patrick Williams | 2544b41 | 2022-10-04 08:41:06 -0500 | [diff] [blame] | 10 | |
| 11 | #include <cstring> |
| 12 | #include <iostream> |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 13 | #include <sstream> |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 14 | |
| 15 | using namespace phosphor; |
| 16 | using namespace logging; |
| 17 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 18 | const char* usage = "Usage: logging-test [OPTION] \n\n\ |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 19 | Options: \n\ |
| 20 | [NONE] Default test case. \n\ |
| 21 | -h, --help Display this usage text. \n\ |
| 22 | -c, --commit <string> Commit desired error. \n\n\ |
| 23 | Valid errors to commit: \n\ |
Marri Devender Rao | 5493210 | 2017-04-04 04:16:35 -0500 | [diff] [blame] | 24 | AutoTestSimple, AutoTestCreateAndCommit\n"; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 25 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 26 | // validate the journal metadata equals the input value |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 27 | int validate_journal(const char* i_entry, const char* i_value) |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 28 | { |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 29 | sd_journal* journal; |
| 30 | const void* data; |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 31 | size_t l; |
| 32 | int rc; |
| 33 | bool validated = false; |
| 34 | |
| 35 | rc = sd_journal_open(&journal, SD_JOURNAL_LOCAL_ONLY); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 36 | if (rc < 0) |
| 37 | { |
| 38 | std::cerr << "Failed to open journal: " << strerror(-rc) << "\n"; |
| 39 | return 1; |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 40 | } |
| 41 | rc = sd_journal_query_unique(journal, i_entry); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 42 | if (rc < 0) |
| 43 | { |
| 44 | std::cerr << "Failed to query journal: " << strerror(-rc) << "\n"; |
| 45 | return 1; |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 46 | } |
| 47 | SD_JOURNAL_FOREACH_UNIQUE(journal, data, l) |
| 48 | { |
| 49 | std::string journ_entry((const char*)data); |
| 50 | std::cout << journ_entry << "\n"; |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 51 | if (journ_entry.find(i_value) != std::string::npos) |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 52 | { |
| 53 | std::cout << "We found it!\n"; |
| 54 | validated = true; |
| 55 | break; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | sd_journal_close(journal); |
| 60 | |
| 61 | rc = (validated) ? 0 : 1; |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 62 | if (rc) |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 63 | { |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 64 | std::cerr << "Failed to find " << i_entry << " with value " << i_value |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 65 | << " in journal!" |
| 66 | << "\n"; |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | return rc; |
| 70 | } |
| 71 | |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 72 | int elog_test() |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 73 | { |
| 74 | // TEST 1 - Basic log |
| 75 | log<level::DEBUG>("Basic phosphor logging test"); |
| 76 | |
| 77 | // TEST 2 - Log with metadata field |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 78 | const char* file_name = "phosphor_logging_test.txt"; |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 79 | int number = 0xFEFE; |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 80 | log<level::DEBUG>( |
| 81 | "phosphor logging test with attribute", |
| 82 | entry("FILE_NAME_WITH_NUM_TEST=%s_%x", file_name, number)); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 83 | |
| 84 | // Now read back and verify our data made it into the journal |
| 85 | int rc = validate_journal("FILE_NAME_WITH_NUM_TEST", |
| 86 | "phosphor_logging_test.txt_fefe"); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 87 | if (rc) |
| 88 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 89 | |
| 90 | // TEST 3 - Create error log with 2 meta data fields (rvalue and lvalue) |
| 91 | number = 0x1234; |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 92 | const char* test_string = "/tmp/test_string/"; |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 93 | try |
| 94 | { |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 95 | elog<example::xyz::openbmc_project::example::elog::TestErrorOne>( |
| 96 | example::xyz::openbmc_project::example::elog::TestErrorOne::ERRNUM( |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 97 | number), |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 98 | example::xyz::openbmc_project::example::elog::TestErrorOne:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 99 | FILE_PATH(test_string), |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 100 | example::xyz::openbmc_project::example::elog::TestErrorOne:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 101 | FILE_NAME("elog_test_3.txt"), |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 102 | example::xyz::openbmc_project::example::elog::TestErrorTwo:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 103 | DEV_ADDR(0xDEADDEAD), |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 104 | example::xyz::openbmc_project::example::elog::TestErrorTwo::DEV_ID( |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 105 | 100), |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 106 | example::xyz::openbmc_project::example::elog::TestErrorTwo:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 107 | DEV_NAME("test case 3")); |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 108 | } |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 109 | catch (const example::xyz::openbmc_project::example::elog::TestErrorOne& e) |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 110 | { |
| 111 | std::cout << "elog exception caught: " << e.what() << std::endl; |
| 112 | } |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 113 | |
Andrew Geissler | df048c1 | 2016-11-10 16:50:35 -0600 | [diff] [blame] | 114 | // Reduce our error namespaces |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 115 | using namespace example::xyz::openbmc_project::example::elog; |
Andrew Geissler | df048c1 | 2016-11-10 16:50:35 -0600 | [diff] [blame] | 116 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 117 | // Now read back and verify our data made it into the journal |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 118 | std::stringstream stream; |
| 119 | stream << std::hex << number; |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 120 | rc = validate_journal(TestErrorOne::ERRNUM::str_short, |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 121 | std::string(stream.str()).c_str()); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 122 | if (rc) |
| 123 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 124 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 125 | rc = validate_journal(TestErrorOne::FILE_PATH::str_short, test_string); |
| 126 | if (rc) |
| 127 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 128 | |
Patrick Williams | 2544b41 | 2022-10-04 08:41:06 -0500 | [diff] [blame] | 129 | rc = validate_journal(TestErrorOne::FILE_NAME::str_short, |
| 130 | "elog_test_3.txt"); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 131 | if (rc) |
| 132 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 133 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 134 | rc = validate_journal(TestErrorTwo::DEV_ADDR::str_short, "0xDEADDEAD"); |
| 135 | if (rc) |
| 136 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 137 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 138 | rc = validate_journal(TestErrorTwo::DEV_ID::str_short, "100"); |
| 139 | if (rc) |
| 140 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 141 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 142 | rc = validate_journal(TestErrorTwo::DEV_NAME::str_short, "test case 3"); |
| 143 | if (rc) |
| 144 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 145 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 146 | // TEST 4 - Create error log with previous entry use |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 147 | number = 0x9876; |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 148 | try |
| 149 | { |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 150 | elog<TestErrorOne>( |
| 151 | TestErrorOne::ERRNUM(number), prev_entry<TestErrorOne::FILE_PATH>(), |
| 152 | TestErrorOne::FILE_NAME("elog_test_4.txt"), |
| 153 | TestErrorTwo::DEV_ADDR(0xDEADDEAD), TestErrorTwo::DEV_ID(100), |
| 154 | TestErrorTwo::DEV_NAME("test case 4")); |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 155 | } |
Patrick Williams | 66491c6 | 2021-10-06 12:23:37 -0500 | [diff] [blame] | 156 | catch (const sdbusplus::exception_t& e) |
Andrew Geissler | 6d910ad | 2016-10-16 20:49:14 -0500 | [diff] [blame] | 157 | { |
| 158 | std::cout << "elog exception caught: " << e.what() << std::endl; |
| 159 | } |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 160 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 161 | // Now read back and verify our data made it into the journal |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 162 | stream.str(""); |
| 163 | stream << std::hex << number; |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 164 | rc = validate_journal(TestErrorOne::ERRNUM::str_short, |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 165 | std::string(stream.str()).c_str()); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 166 | if (rc) |
| 167 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 168 | |
| 169 | // This should just be equal to what we put in test 3 |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 170 | rc = validate_journal(TestErrorOne::FILE_PATH::str_short, test_string); |
| 171 | if (rc) |
| 172 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 173 | |
Patrick Williams | 2544b41 | 2022-10-04 08:41:06 -0500 | [diff] [blame] | 174 | rc = validate_journal(TestErrorOne::FILE_NAME::str_short, |
| 175 | "elog_test_4.txt"); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 176 | if (rc) |
| 177 | return (rc); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 178 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 179 | rc = validate_journal(TestErrorTwo::DEV_ADDR::str_short, "0xDEADDEAD"); |
| 180 | if (rc) |
| 181 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 182 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 183 | rc = validate_journal(TestErrorTwo::DEV_ID::str_short, "100"); |
| 184 | if (rc) |
| 185 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 186 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 187 | rc = validate_journal(TestErrorTwo::DEV_NAME::str_short, "test case 4"); |
| 188 | if (rc) |
| 189 | return (rc); |
Deepak Kodihalli | ac784cc | 2017-01-20 02:59:22 -0600 | [diff] [blame] | 190 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 191 | // Compile fail tests |
| 192 | |
| 193 | // Simple test to prove we fail to compile due to missing param |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 194 | // elog<TestErrorOne>(TestErrorOne::ERRNUM(1), |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 195 | // TestErrorOne::FILE_PATH("test")); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 196 | |
| 197 | // Simple test to prove we fail to compile due to invalid param |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 198 | // elog<TestErrorOne>(TestErrorOne::ERRNUM(1), |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 199 | // TestErrorOne::FILE_PATH("test"), |
| 200 | // TestErrorOne::FILE_NAME(1)); |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 201 | |
| 202 | return 0; |
| 203 | } |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 204 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 205 | void commitError(const char* text) |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 206 | { |
Patrick Venture | 30047bf | 2018-11-01 18:52:15 -0700 | [diff] [blame] | 207 | if (std::strcmp(text, "AutoTestSimple") == 0) |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 208 | { |
| 209 | try |
| 210 | { |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 211 | elog<example::xyz::openbmc_project::example::elog::AutoTestSimple>( |
| 212 | example::xyz::openbmc_project::example::elog::AutoTestSimple:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 213 | STRING("FOO")); |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 214 | } |
Patrick Williams | 66491c6 | 2021-10-06 12:23:37 -0500 | [diff] [blame] | 215 | catch ( |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 216 | const example::xyz::openbmc_project::example::elog::AutoTestSimple& |
Patrick Williams | 66491c6 | 2021-10-06 12:23:37 -0500 | [diff] [blame] | 217 | e) |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 218 | { |
| 219 | std::cout << "elog exception caught: " << e.what() << std::endl; |
| 220 | commit(e.name()); |
| 221 | } |
| 222 | } |
Patrick Venture | 30047bf | 2018-11-01 18:52:15 -0700 | [diff] [blame] | 223 | else if (std::strcmp(text, "AutoTestCreateAndCommit") == 0) |
Marri Devender Rao | 5493210 | 2017-04-04 04:16:35 -0500 | [diff] [blame] | 224 | { |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 225 | report<example::xyz::openbmc_project::example::elog::AutoTestSimple>( |
| 226 | example::xyz::openbmc_project::example::elog::AutoTestSimple:: |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 227 | STRING("FOO")); |
Marri Devender Rao | 5493210 | 2017-04-04 04:16:35 -0500 | [diff] [blame] | 228 | } |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 229 | |
| 230 | return; |
| 231 | } |
| 232 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 233 | int main(int argc, char* argv[]) |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 234 | { |
Patrick Williams | 9936b8a | 2021-04-21 21:45:19 -0500 | [diff] [blame] | 235 | int arg; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 236 | |
| 237 | if (argc == 1) |
| 238 | return elog_test(); |
| 239 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 240 | static struct option long_options[] = { |
| 241 | {"help", no_argument, 0, 'h'}, |
| 242 | {"commit", required_argument, 0, 'c'}, |
| 243 | {0, 0, 0, 0}}; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 244 | int option_index = 0; |
| 245 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 246 | while ((arg = getopt_long(argc, argv, "hc:", long_options, |
| 247 | &option_index)) != -1) |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 248 | { |
| 249 | switch (arg) |
| 250 | { |
| 251 | case 'c': |
| 252 | commitError(optarg); |
| 253 | return 0; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 254 | case 'h': |
| 255 | case '?': |
| 256 | std::cerr << usage; |
| 257 | return 1; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 258 | } |
| 259 | } |
| 260 | |
| 261 | return 0; |
Michael Tritz | e0eb1dd | 2017-02-19 20:57:46 -0600 | [diff] [blame] | 262 | } |