hardcoded python path in garchive and tragesym
[geda-gaf.git] / xorn / tests / netlist / run-test
blob69e1db4f2677e4c0a3dc7e5971172f38857a72d6
1 #!/bin/sh
2 # gaf.netlist - gEDA Netlist Extraction and Generation
3 # Copyright (C) 1998-2010 Ales Hvezda
4 # Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
5 # Copyright (C) 2013-2020 Roland Lutz
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 reference="$1"
22 srcsubdir=`dirname "${reference}"`
23 basename=`basename "${reference}"`
24 stem="${basename%%-*.out}"
25 rel_subdir="${srcsubdir#${srcdir%/}}"
26 if [ "${rel_subdir}" = "${srcsubdir}" ]
27 then
28 echo "ERROR: Test is not in source directory"
29 exit 99 # hard error
31 buildsubdir="${builddir}${rel_subdir}"
33 # input paths
34 input="${srcsubdir}/${stem}.sch"
35 source_library="${srcsubdir}/${stem}-sources"
36 symbol_library="${srcsubdir}/${stem}-symbols"
37 extradir="${srcsubdir}/${stem}-extras"
39 # output paths
40 output="${buildsubdir}/${basename%.out}.new"
42 backend_tmp="${basename#*-}"
43 backend="${backend_tmp%.out}"
44 backend_options=
46 case "${backend}" in
47 guile)
48 backend_options="-O load=${srcdir}/gnet-apitest.scm \
49 -O guile-proc=apitest -O -- -O foo -O bar"
51 spice_sdb-nomunge)
52 backend=spice_sdb
53 backend_options="-O nomunge_mode"
55 spice_sdb-include)
56 backend=spice_sdb
57 backend_options="-O include_mode"
59 spice_sdb-include-nomunge)
60 backend=spice_sdb
61 backend_options="-O include_mode -O nomunge_mode"
63 spice_sdb-sort)
64 backend=spice_sdb
65 backend_options="-O sort_mode"
67 spice_sdb-sort-nomunge)
68 backend=spice_sdb
69 backend_options="-O sort_mode -O nomunge_mode"
71 drc2)
72 backend_options="--ignore-errors"
74 esac
76 test -r "${top_srcdir}/src/backend/gnet_${backend}.py" || exit 77 # skip test
78 # Are there special library folders for this schematic?
79 if [ -d "${source_library}" ]
80 then
81 extra_source_library="--source-library ${source_library}"
82 else
83 extra_source_library=
85 if [ -d "${symbol_library}" ]
86 then
87 extra_symbol_library="--symbol-library ${symbol_library}"
88 else
89 extra_symbol_library=
92 # Create symlink to directory with auxiliary files
93 [ -d "${extradir}" ] && ln -s "${extradir}" . 2>/dev/null
95 ${top_builddir}/src/command/xorn netlist \
96 --symbol-library-search="${srcdir}/std-symbols" \
97 ${extra_symbol_library} ${extra_source_library} \
98 -o "${output}" -g "${backend}" ${backend_options} "${input}"
99 status=$?
100 [ "$status" = 99 ] && exit 99 # propagate hard errors
101 [ "$status" = 0 ] || exit 1
103 # Compare netlist with reference file
104 case "${backend}" in
105 spice_noqsi|spice_sdb)
106 # Strip invocation line
107 reference_filtered="${buildsubdir}/${basename}.filtered"
108 sed '/netlist.*-g/d' "${reference}" > "${reference_filtered}"
109 sed '/netlist.*-g/d' "${output}" > "${output}.filtered"
110 diff "${reference_filtered}" "${output}.filtered"
111 status=$?
112 rm "${reference_filtered}" "${output}.filtered"
115 diff "${reference}" "${output}"
116 status=$?
118 esac
119 [ "$status" = 0 ] || exit 2