<commit_before>#!/usr/bin/env perl
use strict;
use warnings;

use FindBin;
use Gerrit::Client::Test;
use Test::More;

sub run
{
  if (!$ENV{ GERRIT_WAR }) {
    plan skip_all =>
      "To run Gerrit system tests, set GERRIT_WAR to the URL of a gerrit.war "
     ."to use for testing, or set to 1 to automatically download gerrit.war";
    return;
  }

  if ($ENV{ GERRIT_WAR } eq '1') {
    delete $ENV{ GERRIT_WAR };
  }

  my $testdir = "$FindBin::Bin/gerrit";
  my $gerrit = Gerrit::Client::Test->ensure_gerrit_installed(
    war => $ENV{ GERRIT_WAR },
    dir => $testdir,
  );
  ok( $gerrit, "gerrit set up at $testdir" )
    || BAIL_OUT( 'gerrit installation failed; cannot continue' );

  diag( 'test gerrit instance: ', explain( $gerrit ) );
  return;
}

run() unless caller;
done_testing;<commit_msg>test: launch the local test gerrit in the first test, or bail out<commit_after>#!/usr/bin/env perl
use strict;
use warnings;

use FindBin;
use Gerrit::Client::Test;
use Test::More;

sub run
{
  if (!$ENV{ GERRIT_WAR }) {
    plan skip_all =>
      "To run Gerrit system tests, set GERRIT_WAR to the URL of a gerrit.war "
     ."to use for testing, or set to 1 to automatically download gerrit.war";
    return;
  }

  if ($ENV{ GERRIT_WAR } eq '1') {
    delete $ENV{ GERRIT_WAR };
  }

  my $testdir = "$FindBin::Bin/gerrit";
  my $gerrit = Gerrit::Client::Test->ensure_gerrit_installed(
    war => $ENV{ GERRIT_WAR },
    dir => $testdir,
  );
  ok( $gerrit, "gerrit set up at $testdir" )
    || BAIL_OUT( 'gerrit installation failed; cannot continue' );
  ok( $gerrit->ensure_gerrit_running(), 'gerrit running' )
    || BAIL_OUT( "can't launch gerrit" );

  diag( 'test gerrit instance: ', explain( $gerrit ) );
  return;
}

run() unless caller;
done_testing;
{'fraction_non_alphanumeric': 0.1411631846414455, 'fraction_numerical': 0.002258610954263128, 'mean_word_length': 3.5552699228791775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3710220', 'n_tokens_mistral': 681, 'n_tokens_neox': 645, 'n_words': 197}