basic.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # basic.sh -- basic tests for mcron
  2. # Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
  3. # Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  4. #
  5. # This file is part of GNU Mcron.
  6. #
  7. # GNU Mcron is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # GNU Mcron is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
  19. source "${srcdir}/tests/init.sh"
  20. # Use current working directory to store mcron files
  21. XDG_CONFIG_HOME=`pwd`
  22. export XDG_CONFIG_HOME
  23. mkdir cron
  24. cat > cron/foo.guile <<EOF
  25. (job '(next-second) '(display "foo\n"))
  26. EOF
  27. mcron --schedule=1 cron/foo.guile > "output$$"
  28. grep -e "foo" "output$$" || fail_ "'foo.guile' job is not scheduled"
  29. mcron --schedule=1 > "output$$"
  30. grep -e "foo" "output$$" || fail_ "'foo.guile' job is not scheduled"
  31. mcron --date-format="~½" cron/foo.guile \
  32. && fail_ "mcron --date-format unexpected pass"
  33. mcron --log-format="~½" cron/foo.guile \
  34. && fail_ "mcron --log-format unexpected pass"
  35. cron --date-format="~½" cron/foo.guile \
  36. && fail_ "cron --date-format unexpected pass"
  37. cron --log-format="~½" cron/foo.guile \
  38. && fail_ "cron --log-format unexpected pass"
  39. Exit 0