Skip to content

Commit

Permalink
Fixes to the test suite
Browse files Browse the repository at this point in the history
(1) Works around the reloading issue, so now should work correctly in
the automated tests,

(2) improves error messages.
  • Loading branch information
Yahweasel committed Oct 28, 2023
1 parent 03b46a8 commit 058d926
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 4 additions & 6 deletions tests/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ LibAVTestHarness = {
if (!opts && this.libav)
return this.libav;

opts = opts || this.libAVOpts;

const ret = await LibAV.LibAV(opts);
const ret = await LibAV.LibAV(opts || this.libAVOpts);
if (!opts)
this.libav = ret;

Expand Down Expand Up @@ -159,9 +157,9 @@ LibAVTestHarness = {
await test.func(this);
} catch (ex) {
this.printErr("\n" +
JSON.stringify(this.libAVOpts) + "\n" +
test.name + "\n" +
ex + "\n" + ex.stack);
`Error in test ${test.name}\n` +
"Options: " + JSON.stringify(this.libAVOpts) + "\n" +
`Error: ${ex}\n${ex.stack}`);
fails++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/003-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ h.utils.audioF32 = async function(file) {
};

await libav.ffmpeg(
"-nostdin", "-loglevel", "0",
"-nostdin", "-loglevel", "quiet",
"-i", file,
"-f", "f32le",
"-ar", "48000",
Expand All @@ -48,7 +48,7 @@ h.utils.audioF32 = async function(file) {
}

if (file instanceof Array) {
if (file[0].data) {
if (file[0] && file[0].data) {
if (file[0].data.buffer) {
// Frames of flat data
file = new Blob(file.map(x => x.data));
Expand Down
7 changes: 6 additions & 1 deletion tests/tests/621-alt-variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
let data;
{
const libav = await h.LibAV();
await libav.ffmpeg("-i", "bbb.webm", "-map", "0:a", "-c:a", "libvorbis", "tmp.ogg");
await libav.ffmpeg(
"-nostdin", "-loglevel", "quiet",
"-i", "bbb.webm",
"-map", "0:a", "-c:a", "libvorbis",
"tmp.ogg"
);
data = await libav.readFile("tmp.ogg");
await libav.unlink("tmp.ogg");
}
Expand Down

0 comments on commit 058d926

Please sign in to comment.