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.
22 srcsubdir
=`dirname "${reference}"`
23 basename=`basename "${reference}"`
24 stem
="${basename%%-*.out}"
25 rel_subdir
="${srcsubdir#${srcdir%/}}"
26 if [ "${rel_subdir}" = "${srcsubdir}" ]
28 echo "ERROR: Test is not in source directory"
31 buildsubdir
="${builddir}${rel_subdir}"
34 input
="${srcsubdir}/${stem}.sch"
35 source_library
="${srcsubdir}/${stem}-sources"
36 symbol_library
="${srcsubdir}/${stem}-symbols"
37 extradir
="${srcsubdir}/${stem}-extras"
40 output
="${buildsubdir}/${basename%.out}.new"
42 backend_tmp
="${basename#*-}"
43 backend
="${backend_tmp%.out}"
48 backend_options
="-O load=${srcdir}/gnet-apitest.scm \
49 -O guile-proc=apitest -O -- -O foo -O bar"
53 backend_options
="-O nomunge_mode"
57 backend_options
="-O include_mode"
59 spice_sdb-include-nomunge
)
61 backend_options
="-O include_mode -O nomunge_mode"
65 backend_options
="-O sort_mode"
67 spice_sdb-sort-nomunge
)
69 backend_options
="-O sort_mode -O nomunge_mode"
72 backend_options
="--ignore-errors"
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}" ]
81 extra_source_library
="--source-library ${source_library}"
85 if [ -d "${symbol_library}" ]
87 extra_symbol_library
="--symbol-library ${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}"
100 [ "$status" = 99 ] && exit 99 # propagate hard errors
101 [ "$status" = 0 ] ||
exit 1
103 # Compare netlist with reference file
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"
112 rm "${reference_filtered}" "${output}.filtered"
115 diff "${reference}" "${output}"
119 [ "$status" = 0 ] ||
exit 2