template for building tests
This commit is contained in:
parent
f087faf441
commit
2da8d220ad
5 changed files with 88 additions and 0 deletions
16
tests/_template_/Makefile
Normal file
16
tests/_template_/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Makefile to build class 'helloworld' for Pure Data.
|
||||
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
|
||||
# settings and rules.
|
||||
|
||||
# library name
|
||||
lib.name = _template_
|
||||
|
||||
# input source file (class name == source file basename)
|
||||
class.sources = _template_.c
|
||||
|
||||
# all extra files to be included in binary distribution of the library
|
||||
datafiles = _template_-help.pd _template_-meta.pd
|
||||
|
||||
# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
|
||||
PDLIBBUILDER_DIR=../..
|
||||
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
|
||||
4
tests/_template_/_template_-help.pd
Normal file
4
tests/_template_/_template_-help.pd
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#N canvas 335 160 450 300 12;
|
||||
#X obj 143 125 test1;
|
||||
#X msg 143 93 7;
|
||||
#X connect 1 0 0 0;
|
||||
9
tests/_template_/_template_-meta.pd
Normal file
9
tests/_template_/_template_-meta.pd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#N canvas 966 322 200 200 10;
|
||||
#N canvas 19 51 420 300 META 0;
|
||||
#X text 10 10 META this is a prototype of a libdir meta file;
|
||||
#X text 10 51 AUTHOR IOhannes m zmolnig;
|
||||
#X text 10 110 VERSION 1.0.0;
|
||||
#X text 10 90 LICENSE CC0;
|
||||
#X text 10 70 DESCRIPTION Example "_template_" external.;
|
||||
#X text 10 30 NAME _template_;
|
||||
#X restore 10 10 pd META;
|
||||
13
tests/_template_/_template_.c
Normal file
13
tests/_template_/_template_.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <m_pd.h>
|
||||
t_class*_template__class;
|
||||
static void _template__float(t_object*x, t_float f1) {
|
||||
pd_error(x, "%s got %f", __FUNCTION__, f1);
|
||||
}
|
||||
static void*_template__new(void) {
|
||||
return pd_new(_template__class);
|
||||
}
|
||||
void _template__setup(void) {
|
||||
post("%s", __FUNCTION__);
|
||||
_template__class = class_new(gensym("_template_"), _template__new, 0, sizeof(t_object), 0, A_NULL);
|
||||
class_addfloat(_template__class, _template__float);
|
||||
}
|
||||
46
tests/make-from-template.sh
Executable file
46
tests/make-from-template.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
template=_template_
|
||||
template_dir=${0%/*}/${template}
|
||||
|
||||
outdir=$1
|
||||
outdir=${outdir%/}
|
||||
outname=${outdir##*/}
|
||||
|
||||
|
||||
usage() {
|
||||
cat 1>&2 <<EOL
|
||||
usage: $0 <outdir>
|
||||
creates a new test-directory <outdir> from _template_;
|
||||
<outdir> must not exist yet.
|
||||
EOL
|
||||
if [ "x$@" != "x" ]; then
|
||||
echo
|
||||
echo " $@" 1>&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "x${outdir}" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -d "${outdir}" ]; then
|
||||
usage "output directory '${outdir}' already exists!"
|
||||
fi
|
||||
|
||||
if [ ! -d "${template_dir}" ]; then
|
||||
echo "unable to find '${template_dir}'" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${outdir}" || usage "unable to create '${outdir}'!"
|
||||
rmdir "${outdir}"
|
||||
cp -r "${template_dir}" "${outdir}"
|
||||
find "${outdir}" -type f -exec sed -e "s|${template}|${outname}|g" -i {} +
|
||||
for f in "${outdir}"/*; do
|
||||
g=$(echo $f | sed -e "s|${template}|${outname}|g")
|
||||
if [ "x${f}" != "x${g}" ]; then
|
||||
mv "${f}" "${g}"
|
||||
fi
|
||||
done
|
||||
Loading…
Reference in a new issue