Unverified Commit 2bd5a51a authored by 7c6f434c's avatar 7c6f434c Committed by GitHub
Browse files

timidity: add enableVorbis option (#201828)

parents 402b5a14 bb9c4334
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1048,6 +1048,7 @@ in {
  tika = runTest ./tika.nix;
  timescaledb = handleTest ./timescaledb.nix {};
  timezone = handleTest ./timezone.nix {};
  timidity = handleTestOn ["aarch64-linux" "x86_64-linux"] ./timidity {};
  tinc = handleTest ./tinc {};
  tinydns = handleTest ./tinydns.nix {};
  tinyproxy = handleTest ./tinyproxy.nix {};
+20 −0
Original line number Diff line number Diff line
import ../make-test-python.nix (
  { pkgs, ... }:
  {

    name = "timidity";

    nodes.machine =
      { pkgs, ... }:
      {
        environment.systemPackages = [ pkgs.timidity ];
      };

    testScript = ''
      start_all ()

      ## TiMidity++ is around.
      machine.succeed("command -v timidity")
    '';
  }
)
+4 −0
Original line number Diff line number Diff line
inputs: {
  basic = import ./basic.nix inputs;
  with-vorbis = import ./with-vorbis.nix inputs;
}
+4.62 KiB

File added.

No diff preview for this file type.

+40 −0
Original line number Diff line number Diff line
import ../make-test-python.nix (
  { pkgs, ... }:
  {

    name = "timidity-with-vorbis";

    nodes.machine =
      { pkgs, ... }:
      {
        environment.systemPackages = with pkgs; [
          (timidity.override { enableVorbis = true; })
          ffmpeg # # for `ffprobe`
        ];
      };

    testScript = ''
      import json

      start_all()

      ## TiMidity++ is around and it claims to support Ogg Vorbis.
      machine.succeed("command -v timidity")
      machine.succeed("timidity --help | grep 'Ogg Vorbis'")

      ## TiMidity++ manages to process a MIDI input and produces an Ogg Vorbis
      ## output file. NOTE: the `timidity` CLI succeeds even when the input file
      ## does not exist; hence our test for the output file's existence.
      machine.succeed("cp ${./tam-lin.midi} tam-lin.midi")
      machine.succeed("timidity -Ov tam-lin.midi && test -e tam-lin.ogg")

      ## The output file has the expected characteristics.
      metadata_as_text = machine.succeed("ffprobe -show_format -print_format json -i tam-lin.ogg")
      metadata = json.loads(metadata_as_text)
      assert metadata['format']['format_name'] == 'ogg', \
          f"expected 'format_name' to be 'ogg', got '{metadata['format']['format_name']}'"
      assert 37 <= float(metadata['format']['duration']) <= 38, \
          f"expected 'duration' to be between 37s and 38s, got {metadata['format']['duration']}s"
    '';
  }
)
Loading