summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/tests/bibtex-openout-test.pl
blob: 9d45effefa202c5ed3a2bda06dc49bc5a53adc61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env perl
# $Id$
# Copyright 2009 Karl Berry <tex-live@tug.org>.
# You may freely use, modify and/or distribute this file.
# Check that bibtex respects openout_any.

BEGIN {
  chomp ($mydir = `dirname $0`);
  unshift (@INC, "$mydir");
}

exit (&main ());

sub main
{
  # attempt at making it possible to run this when srcdir=builddir.
  $ENV{"srcdir"} = $mydir if ! exists $ENV{"srcdir"};
  my $srcdir = $ENV{"srcdir"};

  $ENV{"TEXMFCNF"} = "$srcdir/../kpathsea";
  $ENV{"BIBINPUTS"} = "$srcdir/tests";
  $ENV{"BSTINPUTS"} = "$srcdir/tests";
  
  $ENV{"openout_any"} = "p";  # should already be in texmf.cnf, but ...
  
  my $prog = "./bibtex";
  die "$0: no program $prog in " . `pwd` if ! -x $prog;

  my @args = ("$srcdir/exampl.aux");  # blg open of abs path should fail

  $ret = system ($prog, @args);
  #warn ("ret=$ret in " . `pwd`);

  # The test fails if the program succeeded.  Ideally we'd grep the output.
  my $bad = ($ret == 0);
  return $bad;
}