summaryrefslogtreecommitdiff
path: root/test/cmd
AgeCommit message (Collapse)Author
2021-07-27test: cmd: setexpr: add format string testsRoland Gaudig
Add test cases for the setexpr format string operator. Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com> [trini: Enable on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-07-23cmd: pinmux: support pin name in status commandPatrick Delaunay
Allow pin name parameter for pimux staus command, as gpio command to get status of one pin. The possible usage of the command is: > pinmux dev pinctrl > pinmux status > pinmux status -a > pinmux status <pin-name> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-15test: Rename final check in setexpr_test_backref()Simon Glass
The bug in setexpr is fixed now, so this test can be enabled. Reported-by: Coverity (CID: 316346) Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-06sandbox: cros-ec: Add tests for the Chromium OS EC PWM driverAlper Nebi Yasak
This patch adds a limited pulse-width modulator to sandbox's Chromium OS Embedded Controller emulation. The emulated PWM device supports multiple channels but can only set a duty cycle for each, as the actual EC doesn't expose any functionality or information other than that. Though the EC supports specifying the PWM channel by its type (e.g. display backlight, keyboard backlight), this is not implemented in the emulation as nothing in U-Boot uses this type specification. This emulated PWM device is then used to test the Chromium OS PWM driver in sandbox. Adding the required device node to the sandbox test device-tree unfortunately makes it the first PWM device, so this also touches some other tests to make sure they still use the sandbox PWM. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-06-08display_options: Drop two spaces before the ASCII columnSimon Glass
At present with print_buffer() U-Boot shows four spaces between the hex and ASCII data. Two seems enough and matches print_hex_dump(). Change it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-12hush: Fix assignments being misinterpreted as commandsSean Anderson
If there were no variable substitutions in a command, then initial assignments would be misinterpreted as commands, instead of being skipped over. This is demonstrated by the following example: => foo=bar echo baz Unknown command 'foo=bar' - try 'help' Signed-off-by: Sean Anderson <seanga2@gmail.com>
2021-03-27test: Silenece the echo and print testsSimon Glass
These tests current produce unwanted output on sandbox. Use the correct functions to controller console output, to avoid this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-22test: cmd: setexpr: Fix a typoBin Meng
SETEXPR_TEST is for a new setexpr test, not mem. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-03-15Merge tag 'v2021.04-rc4' into nextTom Rini
Prepare v2021.04-rc4
2021-03-12test: Add a macros for finding tests in linker_listsSimon Glass
At present we use the linker list directly. This is not very friendly, so add a helpful macro instead. This will also allow us to change the naming later without updating this code. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-12test: Correct setexpr test prefixSimon Glass
This prefix should be for setexpr, not mem. This means that trying to select just these tests to run does not work. Fix it. For some reason this provokes an assertion failure due to memory not being freed. Move the env_set() in setexpr_test_str() to before the malloc() heap size size is recorded and disable the rest in setexpr_test_str_oper(). Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-05test: cmd: Add a basic test for 'addrmap' commandBin Meng
This adds a basic test for the newly introduced 'addrmap' command. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> [Rebase] Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-02-24test: missing dependency for test/cmd/setexpr.cHeinrich Schuchardt
test/cmd/setexpr.c cannot be linked with CONFIG_CMD_SETEXPR=n: ld.bfd: test/built-in.o: in function `setexpr_test_sub': test/cmd/setexpr.c:227: undefined reference to `setexpr_regex_sub' ld.bfd: test/built-in.o: in function `setexpr_test_backref': test/cmd/setexpr.c:267: undefined reference to `setexpr_regex_sub' Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-02-02common: Drop asm/global_data.h from common headerSimon Glass
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2021-01-25test: unit test for echo commandHeinrich Schuchardt
Provide a unit test for the unit command Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-18cmd: Add a pwm commandPragnesh Patel
Add the command "pwm" for controlling the pwm channels. This command provides pwm invert/config/enable/disable functionalities via PWM uclass drivers Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16test: correct the test prefix in ut cmd_memPatrick Delaunay
Align the prefix used in cmd_ut_category function and name of tests for ut mem. This patch solves the issues detected by "make qcheck" after previous patch. Fixes: 550a9e7902ce ("cmd: Update the memory-search command") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Add support for stringsSimon Glass
Add support for dealing with string operands, including reading a string from memory into an environment variable and concatenating two strings. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek BehĂșn <marek.behun@nic.cz>
2020-12-01setexpr: Correct buffer overflow bug and enable testsSimon Glass
At present when more than one substitution is made this function overwrites its buffers. Fix this bug and update the tests now that they can pass. Also update the debug code to show all substrings, since at present it omits the final one. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Correct dropping of final unmatched stringSimon Glass
At present the 'nlen' variable increases with each loop. If the previous loop had back references, then subsequent loops without back references use the wrong value of nlen. The value is larger, meaning that the string terminator from nbuf is copied along to the main buffer, thus terminating the string prematurely. This leads to the final result being truncated, e.g. missing the last (unmatched) part of the string. So "match match tail" become "replaced replaced" instead of "replaced replaced tail". Fix this by resetting nlen to the correct value each time around the lop. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Add some tests for buffer overflow and backrefSimon Glass
Add tests to check for buffer overflow using simple replacement as well as back references. At present these don't fully pass. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01test: Add some setexpr regex testsSimon Glass
Add tests for the setexpr regex commands. Note that these tests currently crash on sandbox due to an existing bug in the setexpr implementation, so two of the tests are commented out. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Add explicit support for 32- and 64-bit intsSimon Glass
At present this function assumes that a size of 4 refers to a ulong. This is true on 32-bit machines but not commonly on 64-bit machines. This means that the 'l' specify does not work correctly with setexpr. Add an explicit case for 32-bit values so that 64-bit machines can still use the 'l' specifier. On 32-bit machines, 64-bit is still not supported. This corrects the operation of the default size (which is 4 for setexpr), so update the tests accordingly. The original code for reading from memory was included in 47ab5ad1457 ("cmd_setexpr: allow memory addresses in expressions") but I am not adding a Fixes: tag since that code was not written with 64-bit machines in mind. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01test: Add some tests for setexprSimon Glass
This command currently has no tests. Add some for basic assignment and the integer operations. Note that the default size for setexpr is ulong, which varies depending on the build machine. So for sandbox on a 64-bit host, this means that the default size is 64 bits. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-07cmd: Update the memory-search commandSimon Glass
Add various fixes and improvements to this command that were missed in the original version. Unfortunately I forgot to send v2. - Fix Kconfig name - Use a separate variable for the remaining search length - Correct a minor bug - Move into a separate test suite - Add -q flag to the 'quiet' test to test operation when console is enabled - Enable the feature for sandbox Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-08cmd: Add a memory-search commandSimon Glass
It is useful to be able to find hex values and strings in a memory range. Add a command to support this. cmd: Fix 'md' and add a memory-search command At present 'md.q' is broken. This series provides a fix for this. It also implements a new memory-search command called 'ms'. It allows searching memory for hex and string data. END Signed-off-by: Simon Glass <sjg@chromium.org>