rollback-hang.t 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright (C) 2006–2023 Alex Schroeder <alex@gnu.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify it under
  4. # the terms of the GNU General Public License as published by the Free Software
  5. # Foundation; either version 3 of the License, or (at your option) any later
  6. # version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this program. If not, see <http://www.gnu.org/licenses/>.
  14. require './t/test.pl';
  15. package OddMuse;
  16. use Test::More tests => 4;
  17. use utf8;
  18. # Reproduce a particular bug from alexschroeder.ch with the rc.log provided.
  19. WriteStringToFile($RcFile, <<'EOT');
  20. 16853910992023-05-29_Net_newsHow to IRCAnonymousAlex2en
  21. 16854004152023-05-29_Net_newsHow to IRCAnonymousAlex3en
  22. 1685430599[[rollback]]1685400415Anonymous
  23. 16855185032023-05-29_Net_newsAnonymousAlex4en
  24. EOT
  25. local $SIG{ALRM} = sub { fail "timeout!"; kill 'KILL', $$; };
  26. alarm 3;
  27. # this is recent changes from between the rollback and the page before it, so there are no pages to roll back
  28. my $page = get_page("action=rss full=1 short=0 from=1685413682");
  29. alarm 0;
  30. test_page($page, '2023-05-29 Net news');
  31. test_page_negative($page, 'rollback');
  32. # Reproduce a follow-up bug. First, rolling back just Test works as intended.
  33. WriteStringToFile($RcFile, <<'EOT');
  34. 1691499987Testham127.0.0.1Berta1
  35. 1691499988Mustuff127.0.0.1Chris1
  36. 1691499989Testspam127.0.0.1Spammer2
  37. 1691499990Test0Rollback to 2023-08-08 13:06 UTC127.0.0.1Alex3
  38. 1691499990[[rollback]]1691499987Test
  39. EOT
  40. my $feed = get_page('action=rc raw=1 from=1691499900'); # need from or the result is empty
  41. test_page($feed, 'title: Test');
  42. # Rolling back all of the wiki doesn't work.
  43. WriteStringToFile($RcFile, <<'EOT');
  44. 1691499987Testham127.0.0.1Berta1
  45. 1691499988Mustuff127.0.0.1Chris1
  46. 1691499989Testspam127.0.0.1Spammer2
  47. 1691499990Test0Rollback to 2023-08-08 13:06 UTC127.0.0.1Alex3
  48. 1691499990[[rollback]]1691499987
  49. EOT
  50. $feed = get_page('action=rc raw=1 from=1691499900'); # need from or the result is empty
  51. test_page($feed, 'title: Test');