Skip to content

Commit

Permalink
Clean up some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Sep 13, 2024
1 parent 56498d6 commit fcdd110
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 517 deletions.
4 changes: 1 addition & 3 deletions lib/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ FS.prototype.HandleEvent = function(id) {
this.events = newevents;
};

FS.prototype.load_from_json = function(fs, done)
FS.prototype.load_from_json = function(fs)
{
dbg_assert(fs, "Invalid fs passed to load_from_json");

Expand All @@ -183,8 +183,6 @@ FS.prototype.load_from_json = function(fs, done)
//{
// this.Check();
//}

done && done();
};

FS.prototype.LoadRecursive = function(data, parentid)
Expand Down
47 changes: 16 additions & 31 deletions src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1179,10 +1179,9 @@ V86.prototype.serial_set_clear_to_send = function(serial, status)
* @param {string} path Path for the mount point
* @param {string|undefined} baseurl
* @param {string|undefined} basefs As a JSON string
* @param {function(Object)=} callback
* @export
*/
V86.prototype.mount_fs = async function(path, baseurl, basefs, callback)
V86.prototype.mount_fs = async function(path, baseurl, basefs)
{
let file_storage = new MemoryFileStorage();

Expand All @@ -1191,39 +1190,26 @@ V86.prototype.mount_fs = async function(path, baseurl, basefs, callback)
file_storage = new ServerFileStorageWrapper(file_storage, baseurl);
}
const newfs = new FS(file_storage, this.fs9p.qidcounter);
const mount = () =>
{
const idx = this.fs9p.Mount(path, newfs);
if(!callback)
{
return;
}
if(idx === -ENOENT)
{
callback(new FileNotFoundError());
}
else if(idx === -EEXIST)
{
callback(new FileExistsError());
}
else if(idx < 0)
{
dbg_assert(false, "Unexpected error code: " + (-idx));
callback(new Error("Failed to mount. Error number: " + (-idx)));
}
else
{
callback(null);
}
};
if(baseurl)
{
dbg_assert(typeof basefs === "object", "Filesystem: basefs must be a JSON object");
newfs.load_from_json(basefs, () => mount());
newfs.load_from_json(basefs);
}
else

const idx = this.fs9p.Mount(path, newfs);

if(idx === -ENOENT)
{
mount();
throw new FileNotFoundError();
}
else if(idx === -EEXIST)
{
throw new FileExistsError();
}
else if(idx < 0)
{
dbg_assert(false, "Unexpected error code: " + (-idx));
throw new Error("Failed to mount. Error number: " + (-idx));
}
};

Expand Down Expand Up @@ -1354,7 +1340,6 @@ V86.prototype.automatically = function(steps)
};

run(steps);

};

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmark/linux-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else

emulator.bus.register("emulator-started", function()
{
console.error("Booting now, please stand by");
console.log("Booting now, please stand by");
start_time = Date.now();
});

Expand Down
Loading

0 comments on commit fcdd110

Please sign in to comment.