1. 24 Jun, 2016 1 commit
  2. 21 Jan, 2016 3 commits
  3. 07 Nov, 2014 2 commits
  4. 27 Oct, 2014 1 commit
    • Simon Glass's avatar
      cli: hush: Adjust 'run' command to run each line of the env var · 87b6398b
      Simon Glass authored
      The run command treats each argument an an environment variable. It gets the
      value of each variable and executes it as a command. If an environment
      variable contains a newline and the hush cli is used, it is supposed to
      execute each line one after the other.
      
      Normally a newline signals to hush to exit - this is used in normal command
      line entry - after a command is entered we want to return to allow the user
      to enter the next one. But environment variables obviously need to execute
      to completion.
      
      Add a special case for the execution of environment variables which
      continues when a newline is seen, and add a few tests to check this
      behaviour.
      
      Note: it's not impossible that this may cause regressions in other areas.
      I can't think of a case but with any change of behaviour with limited test
      coverage there is always a risk. From what I can tell this behaviour has
      been around since at least U-Boot 2011.03, although this pre-dates sandbox
      and I have not tested it on real hardware.
      Reported-by: 's avatarWolfgang Denk <wd@denx.de>
      Signed-off-by: 's avatarSimon Glass <sjg@chromium.org>
      87b6398b
  5. 23 Jun, 2014 1 commit
    • Stephen Warren's avatar
      sandbox: restore ability to access host fs through standard commands · 4d907025
      Stephen Warren authored
      Commit 95fac6ab "sandbox: Use os functions to read host device tree"
      removed the ability for get_device_and_partition() to handle the "host"
      device type, and redirect accesses to it to the host filesystem. This
      broke some unit tests that use this feature. So, revert that change. The
      code added back by this patch is slightly different to pacify checkpatch.
      
      However, we're then left with "host" being both:
      - A pseudo device that accesses the hosts real filesystem.
      - An emulated block device, which accesses "sectors" inside a file stored
        on the host.
      
      In order to resolve this discrepancy, rename the pseudo device from host
      to hostfs, and adjust the unit-tests for this change.
      
      The "help sb" output is modified to reflect this rename, and state where
      the host and hostfs devices should be used.
      Signed-off-by: 's avatarStephen Warren <swarren@nvidia.com>
      Tested-by: 's avatarJosh Wu <josh.wu@atmel.com>
      Acked-by: 's avatarSimon Glass <sjg@chromium.org>
      Tested-by: 's avatarSimon Glass <sjg@chromium.org>
      4d907025
  6. 05 Jun, 2014 1 commit
  7. 07 Mar, 2014 3 commits
    • Stephen Warren's avatar
      unit-test: make "test -e" test independent of $CWD · cfd13e8d
      Stephen Warren authored
      The unit-test for hush's "test -e" currently relies upon being run in
      the U-Boot build directory, because it tests for the existence of a file
      that exists in that directory.
      
      Fix this by explicitly creating the file we use for the existence test,
      and deleting it afterwards so that multiple successive unit-test
      invocations succeed. This required adding an os.c function to erase
      files.
      Reported-by: 's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: 's avatarStephen Warren <swarren@wwwdotorg.org>
      cfd13e8d
    • Stephen Warren's avatar
      hush: fix some quoted variable expansion issues · fe9ca3d3
      Stephen Warren authored
      The following shell command fails:
      
      if test -z "$x"; then echo "zero"; else echo "non-zero"; fi
      
      (assuming $x does not exist, it prints "non-zero" rather than "zero").
      
      ... since "$x" expands to nothing, and the argument is completely
      dropped, causing too few to be passed to -z, causing cmd_test() to
      error out early.
      
      This is because when variable expansions are processed by make_string(),
      the expanded results are concatenated back into a new string. However,
      no quoting is applied when doing so, so any empty variables simply don't
      generate any parameter when the combined string is parsed again.
      
      Fix this by explicitly replacing quoting any argument that was originally
      quoted when re-generating a string from the already-parsed argument list.
      
      This also fixes loss of whitespace in commands such as:
      
      setenv space " "
      setenv var " 1${space}${space} 2 "
      echo ">>${var}<<"
      Reported-by: 's avatarRussell King <linux@arm.linux.org.uk>
      Acked-by: 's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: 's avatarStephen Warren <swarren@wwwdotorg.org>
      fe9ca3d3
    • Stephen Warren's avatar
      unit-test: clean up evironment after Hush tests · eebd1b58
      Stephen Warren authored
      Delete the temporary variables that are used to save unit-test results
      from the environment after running the test. This prevents polluting
      the environment, or growing it too much.
      Signed-off-by: 's avatarStephen Warren <swarren@wwwdotorg.org>
      Acked-by: 's avatarSimon Glass <sjg@chromium.org>
      eebd1b58
  8. 19 Feb, 2014 2 commits
  9. 24 Jul, 2013 1 commit
  10. 09 Aug, 2012 1 commit
    • Simon Glass's avatar
      sandbox: Add basic test for command execution · a72007d9
      Simon Glass authored
      Since run_command() and run_command_list() are important and a little
      confusing, add some basic tests to check that the behaviour is correct.
      
      Note: I am not sure that this should be committed, nor where it should go
      in the source tree. Comments welcome.
      
      To run the unit tests use the ut_cmd command available in sandbox:
      
      make sandbox_config
      make
      ./u-boot -c ut_cmd
      
      (To test both hush and built-in parsers, you need to manually change
      CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)
      Signed-off-by: 's avatarSimon Glass <sjg@chromium.org>
      a72007d9