netlist: Add `tedax' backend
[geda-gaf.git] / tests / netlist / run-test.gnetlist
blobc333a156afff50f627bca007322bc99f8299c9b0
1 #!/bin/sh
2 # xorn.geda.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-2017 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=apitest
49 backend_options="-O foo -O bar"
51 spice_noqsi)
52 backend=spice-noqsi
54 spice_sdb)
55 backend=spice-sdb
57 spice_sdb-nomunge)
58 backend=spice-sdb
59 backend_options="-O nomunge_mode"
61 spice_sdb-include)
62 backend=spice-sdb
63 backend_options="-O include_mode"
65 spice_sdb-include-nomunge)
66 backend=spice-sdb
67 backend_options="-O include_mode -O nomunge_mode"
69 spice_sdb-sort)
70 backend=spice-sdb
71 backend_options="-O sort_mode"
73 spice_sdb-sort-nomunge)
74 backend=spice-sdb
75 backend_options="-O sort_mode -O nomunge_mode"
77 vams)
78 # The vams backend will always write to this file regardless of
79 # the `-o' setting. This is not thread-safe.
80 output=default_entity_arc.net
82 esac
84 # Create symlink to directory with auxiliary files
85 [ -d "${extradir}" ] && ln -s "${extradir}" . 2>/dev/null
87 # Write configuration file
88 pre_backend_scm="${buildsubdir}/${basename%.out}.scm"
90 [ -d "${source_library}" ] &&
91 echo "(source-library \"${source_library}\")"
92 [ -d "${symbol_library}" ] &&
93 echo "(component-library \"${symbol_library}\")"
94 } > "${pre_backend_scm}"
96 gnetlist -l "${pre_backend_scm}" \
97 -o "${output}" -g "${backend}" ${backend_options} "${input}"
98 status=$?
99 rm "${pre_backend_scm}"
100 [ "$status" = 0 ] || exit 1
102 # Compare netlist with reference file
103 case "${backend}" in
104 spice-noqsi|spice-sdb)
105 # Strip invocation line
106 reference_filtered="${buildsubdir}/${basename}.filtered"
107 sed '/netlist.*-g/d' "${reference}" > "${reference_filtered}"
108 sed '/netlist.*-g/d' "${output}" > "${output}.filtered"
109 diff "${reference_filtered}" "${output}.filtered"
110 status=$?
111 rm "${reference_filtered}" "${output}.filtered"
114 diff "${reference}" "${output}"
115 status=$?
117 esac
118 [ "$status" = 0 ] || exit 2