lol

Add basic NixOS tests for TiMidity++

Niols 7518588d 7d96814b

+65
+1
nixos/tests/all-tests.nix
··· 1041 1041 tika = runTest ./tika.nix; 1042 1042 timescaledb = handleTest ./timescaledb.nix {}; 1043 1043 timezone = handleTest ./timezone.nix {}; 1044 + timidity = handleTest ./timidity {}; 1044 1045 tinc = handleTest ./tinc {}; 1045 1046 tinydns = handleTest ./tinydns.nix {}; 1046 1047 tinyproxy = handleTest ./tinyproxy.nix {};
+20
nixos/tests/timidity/basic.nix
··· 1 + import ../make-test-python.nix ( 2 + { pkgs, ... }: 3 + { 4 + 5 + name = "timidity"; 6 + 7 + nodes.machine = 8 + { pkgs, ... }: 9 + { 10 + environment.systemPackages = [ pkgs.timidity ]; 11 + }; 12 + 13 + testScript = '' 14 + start_all () 15 + 16 + ## TiMidity++ is around. 17 + machine.succeed("command -v timidity") 18 + ''; 19 + } 20 + )
+4
nixos/tests/timidity/default.nix
··· 1 + inputs: { 2 + basic = import ./basic.nix inputs; 3 + with-vorbis = import ./with-vorbis.nix inputs; 4 + }
nixos/tests/timidity/tam-lin.midi

This is a binary file and will not be displayed.

+40
nixos/tests/timidity/with-vorbis.nix
··· 1 + import ../make-test-python.nix ( 2 + { pkgs, ... }: 3 + { 4 + 5 + name = "timidity-with-vorbis"; 6 + 7 + nodes.machine = 8 + { pkgs, ... }: 9 + { 10 + environment.systemPackages = with pkgs; [ 11 + (timidity.override { enableVorbis = true; }) 12 + ffmpeg # # for `ffprobe` 13 + ]; 14 + }; 15 + 16 + testScript = '' 17 + import json 18 + 19 + start_all() 20 + 21 + ## TiMidity++ is around and it claims to support Ogg Vorbis. 22 + machine.succeed("command -v timidity") 23 + machine.succeed("timidity --help | grep 'Ogg Vorbis'") 24 + 25 + ## TiMidity++ manages to process a MIDI input and produces an Ogg Vorbis 26 + ## output file. NOTE: the `timidity` CLI succeeds even when the input file 27 + ## does not exist; hence our test for the output file's existence. 28 + machine.succeed("cp ${./tam-lin.midi} tam-lin.midi") 29 + machine.succeed("timidity -Ov tam-lin.midi && test -e tam-lin.ogg") 30 + 31 + ## The output file has the expected characteristics. 32 + metadata_as_text = machine.succeed("ffprobe -show_format -print_format json -i tam-lin.ogg") 33 + metadata = json.loads(metadata_as_text) 34 + assert metadata['format']['format_name'] == 'ogg', \ 35 + f"expected 'format_name' to be 'ogg', got '{metadata['format']['format_name']}'" 36 + assert 37 <= float(metadata['format']['duration']) <= 38, \ 37 + f"expected 'duration' to be between 37s and 38s, got {metadata['format']['duration']}s" 38 + ''; 39 + } 40 + )