diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 657354e8a4..0792d8410f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -2,7 +2,7 @@ name: Ubuntu on: push: - branches: + branches: - '*' pull_request: branches: [ master-dev ] @@ -13,11 +13,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Checkout submodules + run: git submodule update --init --recursive - name: Install libmicrohttpd run: | - sudo apt-get update -qq + sudo apt-get update -qq sudo apt-get install libmicrohttpd-dev - name: Build Faust - run: make \ No newline at end of file + run: make + + - name: Copy c header to expected path by impulse test + run: | + mkdir -p faust/dsp/ + cp compiler/generator/libfaust.h faust/dsp/ + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - name: Run impulse tests (C++ and Rust) + run: cd tests/impulse-tests && make github_action diff --git a/tests/impulse-tests/Make.gcc b/tests/impulse-tests/Make.gcc index 86566920d4..535de601f2 100644 --- a/tests/impulse-tests/Make.gcc +++ b/tests/impulse-tests/Make.gcc @@ -13,7 +13,7 @@ else endif MAKE ?= make -GCCOPTIONS := -O3 -I../../architecture -I/usr/local/include/ap_fixed -Iarchs -pthread -std=c++11 +GCCOPTIONS := -O3 -I../../ -I../../architecture -I/usr/local/include/ap_fixed -Iarchs -pthread -std=c++11 outdir ?= cpp/double lang ?= cpp ext ?= cpp @@ -172,5 +172,11 @@ ir/c1/double/dlt256/osc_enable.c : dsp/osc_enable.dsp @echo "Can only be tested in scalar mode" $(FAUST) -lang $(lang) -double -os -i -A ../../architecture -a archs/$(arch) $< -o $@ +ir/$(outdir)/prefix.ir: + echo "todo fix bug #1071 to test dsp/prefix.dsp" + +ir/cpp/double/mapp/constant.ir: + echo "todo fix bug #1074 to test dsp/constant.dsp" + ir/$(outdir)/%.$(ext) : dsp/%.dsp $(FAUST) -lang $(lang) $(FAUSTOPTIONS) -i -A ../../architecture -a archs/$(arch) $< -o $@ diff --git a/tests/impulse-tests/Make.interp b/tests/impulse-tests/Make.interp index 39f562c30f..4e6b469994 100644 --- a/tests/impulse-tests/Make.interp +++ b/tests/impulse-tests/Make.interp @@ -37,7 +37,7 @@ help: @echo " 'interp' (default): check the double output using the interp backend" @echo @echo "Options:" - @echo " 'outdir' : define the output directory (default to 'llvm')" + @echo " 'outdir' : define the output directory (default to 'llvm')" @echo " 'FAUSTOPTIONS' : define additional faust options (empty by default)" @echo " 'precision' : define filesCompare expected precision (empty by default)" @@ -62,7 +62,8 @@ impulseinterp: $(SRCDIR)/impulseinterp.cpp $(LIB) ######################################################################### # rules for interp -# Specific rule to test 'control' primitive that currently uses the -lang ocpp backend (still compiling in scalar mode...) +# Specific rule to test 'control' primitive that currently uses the -lang ocpp backend +# (still compiling in scalar mode...) ir/$(outdir)/control.ir: dsp/control.dsp reference/control.ir @echo "Cannot be tested with the Interp backend" diff --git a/tests/impulse-tests/Make.rust b/tests/impulse-tests/Make.rust index b88af02d2c..8657e2ee87 100644 --- a/tests/impulse-tests/Make.rust +++ b/tests/impulse-tests/Make.rust @@ -15,114 +15,55 @@ MAKE ?= make outdir ?= rust FAUSTOPTIONS ?= -double +CARGOOPTIONS ?= --release precision ?= # filesCompare precision (empty by default) .PHONY: test .DELETE_ON_ERROR: -alldspfiles := $(wildcard dsp/*.dsp) -allirfiles = $(alldspfiles:dsp/%.dsp=ir/rust/%.ir) - -all: filesCompare - -# Currently this lists all dependencies manually to allow for easily enabling/disabling -# individual test cases. Later this can be replaced by the wildcard dependency: -# all: $(allirfiles) - -all: ir/rust/APF.ir -all: ir/rust/BPF.ir -all: ir/rust/HPF.ir -all: ir/rust/LPF.ir -all: ir/rust/UITester.ir -all: ir/rust/bandfilter.ir -all: ir/rust/bargraph.ir -all: ir/rust/bs.ir -all: ir/rust/capture.ir -all: ir/rust/carre_volterra.ir -all: ir/rust/comb_bug_exp.ir -all: ir/rust/comb_delay1.ir -all: ir/rust/comb_delay2.ir -all: ir/rust/constant.ir -all: ir/rust/cubic_distortion.ir -all: ir/rust/dbmeter.ir -all: ir/rust/delays.ir -all: ir/rust/echo_bug.ir -all: ir/rust/echo.ir -all: ir/rust/freeverb.ir -all: ir/rust/gate_compressor.ir -all: ir/rust/harpe.ir -all: ir/rust/highShelf.ir -all: ir/rust/karplus.ir -all: ir/rust/karplus32.ir -all: ir/rust/lfboost.ir -all: ir/rust/logical.ir -all: ir/rust/lowboost.ir -all: ir/rust/lowcut.ir -all: ir/rust/lowShelf.ir -all: ir/rust/math.ir -all: ir/rust/math_simp.ir -all: ir/rust/matrix.ir -all: ir/rust/midi_tester.ir -all: ir/rust/mixer.ir -all: ir/rust/modulations.ir -all: ir/rust/multibandfilter.ir -all: ir/rust/noise.ir -all: ir/rust/noiseabs.ir -all: ir/rust/noisemetadata.ir -all: ir/rust/notch.ir -all: ir/rust/osc_enable.ir -all: ir/rust/osc.ir -all: ir/rust/osci.ir -all: ir/rust/panpot.ir -all: ir/rust/parametric_eq.ir -all: ir/rust/peakingEQ.ir -all: ir/rust/peakNotch.ir -all: ir/rust/phaser_flanger.ir -all: ir/rust/pitch_shifter.ir -all: ir/rust/pow.ir -all: ir/rust/precision.ir -#all: ir/rust/prefix.ir -all: ir/rust/priority.ir -all: ir/rust/priority1.ir -all: ir/rust/quadecho.ir -all: ir/rust/reverb_designer.ir -all: ir/rust/reverb_tester.ir -all: ir/rust/smoothdelay.ir -#all: ir/rust/sound.ir -all: ir/rust/spat.ir -all: ir/rust/spectral_level.ir -all: ir/rust/spectral_tilt.ir -all: ir/rust/stereoecho.ir -all: ir/rust/switcher.ir -all: ir/rust/table.ir -all: ir/rust/table1.ir -all: ir/rust/table2.ir -all: ir/rust/tapiir.ir -all: ir/rust/tester.ir -all: ir/rust/tester2.ir -all: ir/rust/tf_exp.ir -all: ir/rust/thru_zero_flanger.ir -all: ir/rust/UITester.ir -all: ir/rust/vcf_wah_pedals.ir -all: ir/rust/virtual_analog_oscillators.ir -all: ir/rust/volume.ir -all: ir/rust/vumeter.ir -all: ir/rust/waveform1.ir -all: ir/rust/waveform2.ir -all: ir/rust/waveform3.ir -all: ir/rust/waveform4.ir -all: ir/rust/waveform5.ir -all: ir/rust/waveform6.ir -all: ir/rust/zita_rev1.ir - -filesCompare: +dspfiles := $(wildcard dsp/*.dsp) +listfiles = $(dspfiles:dsp/%.dsp=ir/$1/%.ir) + +######################################################################### +all: filesCompare ir/$(outdir) $(call listfiles,$(outdir)) + +######################################################################### +# output directories +ir/$(outdir): + mkdir -p ir/$(outdir) + + +######################################################################### +# tools +filesCompare: $(MAKE) filesCompare ######################################################################### # rules -ir/$(outdir)/%.ir: reference/%.ir - mkdir -p ir/$(outdir) - $(FAUST) -lang rust $(FAUSTOPTIONS) -i -A ../../architecture -a archs/rust/architecture.rs dsp/$*.dsp -o archs/rust/src/bin/$*.rs - #cd archs/rust/ && cargo run --bin $* ../../$@ - cd archs/rust/ && cargo run --release --bin $* ../../$@ - $(COMPARE) $@ reference/$(notdir $@) $(precision) + +ir/$(outdir)/sound.ir: dsp/sound.dsp + $(FAUST) -lang rust $(FAUSTOPTIONS) dsp/sound.dsp -o archs/rust/src/bin/sound.rs > $@ 2>&1 || (echo "expected failure") + grep "ERROR : 'soundfile' primitive not yet supported for Rust" $@ + +ir/rust/ec/bs.ir: dsp/bs.dsp + $(FAUST) -lang rust $(FAUSTOPTIONS) dsp/bs.dsp -o archs/rust/src/bin/bs.rs > $@ 2>&1 || (echo "expected failure") + grep "ERROR : accessing foreign variable 'count' is not allowed in this compilation mode" $@ + +ir/rust/vec4/osc_enable.ir: dsp/osc_enable.dsp + $(FAUST) -lang rust $(FAUSTOPTIONS) dsp/osc_enable.dsp -o archs/rust/src/bin/osc_enable.rs > $@ 2>&1 || (echo "expected failure") + grep "ERROR : 'control/enable' can only be used in scalar mode" $@ + +ir/rust/vec32/osc_enable.ir: dsp/osc_enable.dsp + $(FAUST) -lang rust $(FAUSTOPTIONS) dsp/osc_enable.dsp -o archs/rust/src/bin/osc_enable.rs > $@ 2>&1 || (echo "expected failure") + grep "ERROR : 'control/enable' can only be used in scalar mode" $@ + +ir/rust/vec4/prefix.ir: + echo "todo fix bug #1071 to test dsp/prefix.dsp" + +ir/rust/vec32/prefix.ir: + echo "todo fix bug #1071 to test dsp/prefix.dsp" + +ir/$(outdir)/%.ir: dsp/%.dsp reference/%.ir + $(FAUST) -lang rust $(FAUSTOPTIONS) dsp/$*.dsp -o archs/rust/src/bin/$*.rs + cd archs/rust/ && cargo run $(CARGOOPTIONS) --bin $* ../../$@ + $(COMPARE) $@ reference/$(notdir $@) $(precision) || (rm -f $@; false) diff --git a/tests/impulse-tests/Makefile b/tests/impulse-tests/Makefile index afa0508fd3..f60fab0780 100644 --- a/tests/impulse-tests/Makefile +++ b/tests/impulse-tests/Makefile @@ -112,41 +112,48 @@ help: ######################################################################### # automatic travis test travis: - $(MAKE) -f Make.gcc outdir=cpp/double lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double" - $(MAKE) -f Make.gcc outdir=cpp/double/dlt0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -dlt 0" - $(MAKE) -f Make.gcc outdir=cpp/double/vec lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -fun" - $(MAKE) -f Make.gcc outdir=cpp/double/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -omp" - #$(MAKE) -f Make.gcc outdir=cpp/double/sch lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -sch" + $(MAKE) -f Make.gcc outdir=cpp/double lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double" + $(MAKE) -f Make.gcc outdir=cpp/double/dlt0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -dlt 0" + $(MAKE) -f Make.gcc outdir=cpp/double/vec lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -fun" + $(MAKE) -f Make.gcc outdir=cpp/double/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -omp" + #$(MAKE) -f Make.gcc outdir=cpp/double/sch lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -sch" + +######################################################################### +# automatic github action test +github_action: + $(MAKE) -f Make.gcc outdir=cpp/double lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double" + $(MAKE) -f Make.rust outdir=rust/no CARGOOPTIONS="" FAUSTOPTIONS="-I ../../libraries/ -double -a archs/rust/architecture.rs" + $(MAKE) -f Make.rust outdir=rust/vec4 CARGOOPTIONS="" FAUSTOPTIONS="-I ../../libraries/ -double -vec -vs 4 -a archs/rust/architecture.rs" ######################################################################### # c++ and c backends cpp: - $(MAKE) -f Make.gcc outdir=cpp/double lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double" - $(MAKE) -f Make.gcc outdir=cpp/double/uim lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -uim" - $(MAKE) -f Make.gcc outdir=cpp/double/it lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -it" - $(MAKE) -f Make.gcc outdir=cpp/double/fp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -fp" - $(MAKE) -f Make.gcc outdir=cpp/double/wall lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -wall" - $(MAKE) -f Make.gcc outdir=cpp/double/mcd0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -mcd 0" - $(MAKE) -f Make.gcc outdir=cpp/double/mapp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -mapp" - $(MAKE) -f Make.gcc outdir=cpp/double/rui lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -rui" - $(MAKE) -f Make.gcc outdir=cpp/double/nvi lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -nvi" - $(MAKE) -f Make.gcc outdir=cpp/double/dlt0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -dlt 0" - $(MAKE) -f Make.gcc outdir=cpp/double/dlt256 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -dlt 256" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 0" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 0 -fun" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0/vs16 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 0 -vs 16" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 1" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 1 -fun" - $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1/vs16 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -vec -lv 1 -vs 16" - $(MAKE) -f Make.gcc outdir=cpp/double/sched lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -sch" - $(MAKE) -f Make.gcc outdir=cpp/double/sched/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -sch -fun" - $(MAKE) -f Make.gcc outdir=cpp/double/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -omp" - $(MAKE) -f Make.gcc outdir=cpp/double/omp/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -double -omp -fun" - $(MAKE) -f Make.gcc outdir=cpp/float lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -single" - $(MAKE) -f Make.gcc outdir=cpp/float/vec lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -single -vec" - $(MAKE) -f Make.gcc outdir=cpp/float/sched lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -single -sch" - $(MAKE) -f Make.gcc outdir=cpp/float/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -single -omp" + $(MAKE) -f Make.gcc outdir=cpp/double lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double" + $(MAKE) -f Make.gcc outdir=cpp/double/uim lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -uim" + $(MAKE) -f Make.gcc outdir=cpp/double/it lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -it" + $(MAKE) -f Make.gcc outdir=cpp/double/fp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -fp" + $(MAKE) -f Make.gcc outdir=cpp/double/wall lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -wall" + $(MAKE) -f Make.gcc outdir=cpp/double/mcd0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -mcd 0" + $(MAKE) -f Make.gcc outdir=cpp/double/mapp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -mapp" + $(MAKE) -f Make.gcc outdir=cpp/double/rui lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -rui" + $(MAKE) -f Make.gcc outdir=cpp/double/nvi lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -nvi" + $(MAKE) -f Make.gcc outdir=cpp/double/dlt0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -dlt 0" + $(MAKE) -f Make.gcc outdir=cpp/double/dlt256 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -dlt 256" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 0" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 0 -fun" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv0/vs16 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 0 -vs 16" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 1" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 1 -fun" + $(MAKE) -f Make.gcc outdir=cpp/double/vec/lv1/vs16 lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -vec -lv 1 -vs 16" + $(MAKE) -f Make.gcc outdir=cpp/double/sched lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -sch" + $(MAKE) -f Make.gcc outdir=cpp/double/sched/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -sch -fun" + $(MAKE) -f Make.gcc outdir=cpp/double/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -omp" + $(MAKE) -f Make.gcc outdir=cpp/double/omp/fun lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -double -omp -fun" + $(MAKE) -f Make.gcc outdir=cpp/float lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -single" + $(MAKE) -f Make.gcc outdir=cpp/float/vec lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -single -vec" + $(MAKE) -f Make.gcc outdir=cpp/float/sched lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -single -sch" + $(MAKE) -f Make.gcc outdir=cpp/float/omp lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I ../../libraries/ -I dsp -single -omp" quad: $(MAKE) -f Make.gcc outdir=cpp/quad lang=cpp arch=impulsearch.cpp FAUSTOPTIONS="-I dsp -quad" @@ -362,13 +369,10 @@ interp1: ######################################################################### # Rust backend rust: - $(MAKE) -f Make.rust FAUSTOPTIONS="-I dsp -double" - rm -rf ir/rust - $(MAKE) -f Make.rust FAUSTOPTIONS="-I dsp -double -fp" - rm -rf ir/rust - $(MAKE) -f Make.rust FAUSTOPTIONS="-I dsp -double -vec -vs 4" - rm -rf ir/rust - $(MAKE) -f Make.rust FAUSTOPTIONS="-I dsp -double -vec -vs 32" + $(MAKE) -f Make.rust outdir=rust/no FAUSTOPTIONS="-I ../../libraries/ -double -a archs/rust/architecture.rs" + $(MAKE) -f Make.rust outdir=rust/fp FAUSTOPTIONS="-I ../../libraries/ -double -fp -a archs/rust/architecture.rs" + $(MAKE) -f Make.rust outdir=rust/vec4 FAUSTOPTIONS="-I ../../libraries/ -double -vec -vs 4 -a archs/rust/architecture.rs" + $(MAKE) -f Make.rust outdir=rust/vec32 FAUSTOPTIONS="-I ../../libraries/ -double -vec -vs 32 -a archs/rust/architecture.rs" ######################################################################### # Cmajor backend