Trog-Routes-HTML-series-lifecycle-sqlite.t 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env perl
  2. # The whole lifecycle suite again, against the SQLite data model.
  3. #
  4. # A data model is only finished when the application cannot tell which one it is
  5. # talking to, and every assertion in that file is about what the app does rather
  6. # than about how anything is stored -- so all of them have to hold for any model.
  7. # Run as a separate process because the model is chosen once, from config, at
  8. # the point Trog::Data builds it.
  9. use 5.040;
  10. use re '/aasx';
  11. use warnings;
  12. use Test::More;
  13. use File::Temp ();
  14. use FindBin;
  15. my $suite = "$FindBin::Bin/Trog-Routes-HTML-series-lifecycle.t";
  16. ok( -f $suite, 'the lifecycle suite is there to run' ) or BAIL_OUT("Can't find $suite");
  17. # Captured rather than inherited: the child speaks TAP too, and two test streams
  18. # down one pipe is not a test result, it is a parse error.
  19. my ( $fh, $log ) = File::Temp::tempfile( 'lifecycle-sqlite-XXXXXX', TMPDIR => 1, UNLINK => 1 );
  20. close $fh;
  21. my $rc = do {
  22. local $ENV{TCMS_TEST_DATA_MODEL} = 'SQLite';
  23. system(qq{$^X "-I$FindBin::Bin/../lib" "$suite" > "$log" 2>&1});
  24. };
  25. is( $rc, 0, 'the whole lifecycle passes on the SQLite data model' ) or do {
  26. open( my $out, '<', $log ) or return;
  27. diag($_) while ( $_ = <$out> );
  28. close $out;
  29. };
  30. done_testing();