xref: /aosp_15_r20/external/flac/test/common.sh.in (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1#  FLAC - Free Lossless Audio Codec
2#  Copyright (C) 2001-2009  Josh Coalson
3#  Copyright (C) 2011-2023  Xiph.Org Foundation
4#
5#  This file is part the FLAC project.  FLAC is comprised of several
6#  components distributed under different licenses.  The codec libraries
7#  are distributed under Xiph.Org's BSD-like license (see the file
8#  COPYING.Xiph in this distribution).  All other programs, libraries, and
9#  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
10#  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
11#  FLAC distribution contains at the top the terms under which it may be
12#  distributed.
13#
14#  Since this particular file is relevant to all components of FLAC,
15#  it may be distributed under the Xiph.Org license, which is the least
16#  restrictive of those mentioned above.  See the file COPYING.Xiph in this
17#  distribution.
18
19export MALLOC_CHECK_=3
20export MALLOC_PERTURB_=$((RANDOM % 255 + 1))
21
22if [ -z "$1" ] ; then
23	BUILD=debug
24else
25	BUILD="$1"
26fi
27
28LD_LIBRARY_PATH=../objs/$BUILD/lib:$LD_LIBRARY_PATH
29LD_LIBRARY_PATH="$(pwd)/../objs/$BUILD/lib:$LD_LIBRARY_PATH"
30LD_LIBRARY_PATH="$(pwd)/../src/libFLAC/.libs:$LD_LIBRARY_PATH"
31LD_LIBRARY_PATH="$(pwd)/../src/share/getopt/.libs:$LD_LIBRARY_PATH"
32LD_LIBRARY_PATH="$(pwd)/../src/share/grabbag/.libs:$LD_LIBRARY_PATH"
33LD_LIBRARY_PATH="$(pwd)/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH"
34LD_LIBRARY_PATH="$(pwd)/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH"
35LD_LIBRARY_PATH="$(pwd)/../src/share/utf8/.libs:$LD_LIBRARY_PATH"
36LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
37LD_LIBRARY_PATH=../src/libFLAC++/.libs:$LD_LIBRARY_PATH
38LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH
39LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH
40LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
41LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH
42LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH
43
44export LD_LIBRARY_PATH
45
46PATH="$(pwd)/../objs/$CMAKE_CONFIG_TYPE:$PATH"
47PATH="$(pwd)/../objs:$PATH"
48
49EXE=@EXEEXT@
50
51# Needed for building out-of-tree where source files are in the $top_srcdir tree
52# and build products in the $top_builddir tree.
53top_srcdir=@top_srcdir@
54top_builddir=@top_builddir@
55git_commit_version_hash=@GIT_COMMIT_VERSION_HASH@
56
57# Set `is_win` variable which is used in other scripts that source this one.
58if test $(env | grep -ic '^comspec=') != 0 ; then
59	is_win=yes
60else
61	is_win=no
62fi
63
64# change to 'false' to show all flac/metaflac output (useful for debugging)
65if true ; then
66	SILENT='--silent'
67	TOTALLY_SILENT='--totally-silent'
68else
69	SILENT=''
70	TOTALLY_SILENT=''
71fi
72
73# Functions
74
75die ()
76{
77	echo $* 1>&2
78	exit 1
79}
80
81make_streams ()
82{
83	echo "Generating streams..."
84	if [ ! -f wacky1.wav ] ; then
85		test_streams${EXE} || die "ERROR during test_streams"
86	fi
87}
88