schedule.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # schedule.sh -- Check mcron schedule output
  2. # Copyright © 2017, 2018 Mathieu Lirzin <mthl@gnu.org>
  3. #
  4. # This file is part of GNU Mcron.
  5. #
  6. # GNU Mcron is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # GNU Mcron is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
  18. source "${srcdir}/tests/init.sh"
  19. # Use UTC and SOURCE_DATE_EPOCH to get reproducible result.
  20. SOURCE_DATE_EPOCH=1
  21. export SOURCE_DATE_EPOCH
  22. TZ=UTC0
  23. export TZ
  24. LC_ALL=C
  25. export LC_ALL
  26. # Use current working directory to store mcron files
  27. XDG_CONFIG_HOME=`pwd`
  28. export XDG_CONFIG_HOME
  29. mkdir cron
  30. cat > cron/foo.guile <<EOF
  31. (job '(next-second) '(display "foo\n"))
  32. EOF
  33. cat > cron/bar.guile <<EOF
  34. (job '(next-second) '(display "bar\n"))
  35. EOF
  36. cat > expected <<EOF
  37. Thu Jan 1 00:00:01 1970 +0000
  38. (display bar
  39. )
  40. Thu Jan 1 00:00:01 1970 +0000
  41. (display foo
  42. )
  43. Thu Jan 1 00:00:02 1970 +0000
  44. (display bar
  45. )
  46. Thu Jan 1 00:00:02 1970 +0000
  47. (display foo
  48. )
  49. Thu Jan 1 00:00:03 1970 +0000
  50. (display bar
  51. )
  52. Thu Jan 1 00:00:03 1970 +0000
  53. (display foo
  54. )
  55. Thu Jan 1 00:00:04 1970 +0000
  56. (display bar
  57. )
  58. Thu Jan 1 00:00:04 1970 +0000
  59. (display foo
  60. )
  61. Thu Jan 1 00:00:05 1970 +0000
  62. (display bar
  63. )
  64. Thu Jan 1 00:00:05 1970 +0000
  65. (display foo
  66. )
  67. Thu Jan 1 00:00:06 1970 +0000
  68. (display bar
  69. )
  70. Thu Jan 1 00:00:06 1970 +0000
  71. (display foo
  72. )
  73. Thu Jan 1 00:00:07 1970 +0000
  74. (display bar
  75. )
  76. Thu Jan 1 00:00:07 1970 +0000
  77. (display foo
  78. )
  79. Thu Jan 1 00:00:08 1970 +0000
  80. (display bar
  81. )
  82. Thu Jan 1 00:00:08 1970 +0000
  83. (display foo
  84. )
  85. Thu Jan 1 00:00:09 1970 +0000
  86. (display bar
  87. )
  88. Thu Jan 1 00:00:09 1970 +0000
  89. (display foo
  90. )
  91. Thu Jan 1 00:00:10 1970 +0000
  92. (display bar
  93. )
  94. Thu Jan 1 00:00:10 1970 +0000
  95. (display foo
  96. )
  97. EOF
  98. mcron --schedule=10 > output
  99. diff expected output || fail_ "schedule output is not correct"
  100. Exit 0