summaryrefslogtreecommitdiff
path: root/test/utils_str.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Align behavior of strtoi() and strtoul() to match Linux manpage ↵Mary Ruthven2021-11-181-97/+0
| | | | | | | | | | | | | | description of strtol()." This reverts commit ac8a13329b0b321daeb87f6afb79c163beb21372. BUG=b:200823466 TEST=make buildall -j Change-Id: I379e5fc1ebd15030715561732ea71eb6fda8406d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273383 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "utils: Add strstr"Mary Ruthven2021-11-181-15/+0
| | | | | | | | | | | | This reverts commit 620b7164dddf12df27d5380d647c921853c036dc. BUG=b:200823466 TEST=make buildall -j Change-Id: Ifdd8baeff50d7be572826057ad6419038f17bd61 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273358 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* utils: Add strstrDaisuke Nojiri2019-10-011-0/+15
| | | | | | | | | | | | | | | | | | The strstr API searches for s2 in s1 and returns the pointer to the substring found in s1. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=make run-utils_str Change-Id: I30f5e8d03e304d28dd6e9bfeebfcaeee2e79ea85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1818727 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* Align behavior of strtoi() and strtoul() to match Linux manpage description ↵Jes Klinke2019-05-141-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | of strtol(). Behavior changes: 1) Initial '+' character is tolerated. 2) Hexadecimal strings prefixed with "0x" are rejected, if given base parameter is anything other than 16 or 0, rather than parsed as hex, diregarding the given base. 3) If given base is 0, strings starting with leading zero will be parsed as octal, rather than decimal. 4) Initial '-' character allowed before "0x" on hexadecimal numbers. (Note: This is my first time using git or gerrit, please let me know if there is some policy or customs that I am not properly adhering to.) BRANCH=none TEST=make run-utils_str V=1 Bug: 940329 Change-Id: I71654471b77f0df071a58ff6bed7028f00cd46b5 Signed-off-by: Jes Bodi Klinke <jbk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1577750 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common/printf: snprintf: Return number of bytes on successNicolas Boichat2018-06-281-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | As indicated in the man page: """ Upon successful return, these functions return the number of characters printed (excluding the null byte used to end output to strings). """ There are no users of the return value currently in the EC code, but this matters when doing fuzzing, as libFuzzer calls std::to_string, which expects the correct return value. BRANCH=none BUG=chromium:854975 TEST=make buildfuzztests -j && ASAN_OPTIONS="log_path=stderr" \ build/host/usb_pd_fuzz/usb_pd_fuzz.exe -jobs=10 actually creates 10 output files. TEST=make run-utils_str -j Change-Id: If6a040f690dd847f4c88c3b8566554afdfbabc32 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1116625 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* tests: Split utils in 2 subtestsNicolas Boichat2017-05-251-0/+162
utils test is a little too large for hammer's small RO, so we split it in 2 test: utils and utils_str. Instead of one test that requires about 8kb extra flash, we have 2 tests that take respectively 3.4kb (utils_str) and 4.6kb (utils) of extra flash. BRANCH=none BUG=chromium:726113 TEST=make BOARD=hammer tests -j util/flash_ec --board=hammer --image=build/hammer/test-utils.bin runtest => pass Repeat with test-utils_str.bin TEST=Before this change: make runtests -j ./util/run_host_test utils | grep Running | sort > old Apply this change: make runtests -j (./util/run_host_test utils; ./util/run_host_test utils_str) \ | grep Running | sort > new diff old new => No difference (except timing) Change-Id: I917d572e671d6ce0a8799508761f55de7bd83133 Reviewed-on: https://chromium-review.googlesource.com/514604 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>