clockdiff01.sh 657 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved.
  4. # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
  5. TST_TESTFUNC="do_test"
  6. TST_NEEDS_ROOT=1
  7. TST_NEEDS_CMDS="cut clockdiff"
  8. . tst_net.sh
  9. do_test()
  10. {
  11. tst_res TINFO "check time delta for $(tst_ipaddr)"
  12. local output=$(clockdiff $(tst_ipaddr))
  13. if [ $? -ne 0 ]; then
  14. tst_res TFAIL "clockdiff failed to get delta"
  15. else
  16. delta=$(echo "$output" | cut -d' ' -f2,3)
  17. if [ "$delta" = "0 0" ]; then
  18. tst_res TPASS "delta is 0 as expected"
  19. else
  20. tst_res TFAIL "not expected data received: '$output'"
  21. fi
  22. fi
  23. }
  24. tst_run