Add more testing tools

master
Sven Slootweg 7 years ago
parent 7acf79e5f0
commit 85e1740708

@ -24,6 +24,7 @@
"@joepie91/gulp-preset-es2015": "^1.0.1",
"@joepie91/gulp-preset-pegjs": "^1.0.0",
"babel-preset-es2015": "^6.6.0",
"bluebird": "^3.5.0",
"gulp": "^3.9.1"
}
}

@ -0,0 +1,31 @@
'use strict';
const Promise = require("bluebird");
const fs = Promise.promisifyAll(require("fs"));
const path = require("path");
const util = require("util");
const parse = require("./lib");
let completed = 0;
Promise.try(() => {
return fs.readdirAsync("/nix/store")
}).filter((storePath) => {
return /.+\.drv$/.test(storePath);
}).map((storePath, i, total) => {
return Promise.try(() => {
return fs.readFileAsync(path.join("/nix/store", storePath));
}).then((contents) => {
parse(contents.toString());
}).catch((err) => {
console.error(path.join("/nix/store", storePath));
console.error(util.inspect(err, {colors: true}));
throw err;
}).then(() => {
completed += 1;
console.log(`Completed ${completed}/${total} derivations...`);
});
}, {concurrency: 1}).catch((err) => {
// do nothing
});

@ -1,12 +1,18 @@
'use strict';
const Promise = require("bluebird");
const fs = Promise.promisifyAll(require("fs"));
const path = require("path");
const util = require("util");
const parse = require("./lib");
let testDerivation = 'Derive([("dev","/nix/store/lpwm4gcsda53g26jp6rxz4x13l8lywzg-libXdmcp-1.1.2-dev","",""),("doc","/nix/store/y8925a01zwzrw0sakpv066bc4m6b2qj5-libXdmcp-1.1.2-doc","",""),("out","/nix/store/3iq0cd1ll0c7hss8xxgalxqn0jm0b2mi-libXdmcp-1.1.2","","")],[("/nix/store/3l3gnqvlwrmiqdma5vg3zibkabv4d6wh-pkg-config-0.29.drv",["out"]),("/nix/store/6qrlismj26hncj3809k302z6d3ycfwhh-stdenv.drv",["out"]),("/nix/store/flyb4cyxz0s48iq8qcdxdf2bcmgcc4cq-bash-4.3-p48.drv",["out"]),("/nix/store/pm59fc4bwblygsfxbq5dr72lkg7wxwsi-libXdmcp-1.1.2.tar.bz2.drv",["out"]),("/nix/store/w3qvvackybwaq6d2sw58yacsrbbrxa4b-xproto-7.0.29.drv",["out"])],["/nix/store/zsi9kk33hj7kvjfw0zahpdsiggg58nn4-builder.sh"],"x86_64-linux","/nix/store/gabjbkwga2dhhp2wzyaxl83r8hjjfc37-bash-4.3-p48/bin/bash",["-e","/nix/store/zsi9kk33hj7kvjfw0zahpdsiggg58nn4-builder.sh"],[("buildInputs",""),("builder","/nix/store/gabjbkwga2dhhp2wzyaxl83r8hjjfc37-bash-4.3-p48/bin/bash"),("dev","/nix/store/lpwm4gcsda53g26jp6rxz4x13l8lywzg-libXdmcp-1.1.2-dev"),("doc","/nix/store/y8925a01zwzrw0sakpv066bc4m6b2qj5-libXdmcp-1.1.2-doc"),("hardeningDisable","bindnow relro"),("name","libXdmcp-1.1.2"),("nativeBuildInputs","/nix/store/y419xb805psvlia6rl2jjrxmfsin5v63-pkg-config-0.29 /nix/store/cpy3mign235h3bjx63jz4baiislqznb9-xproto-7.0.29"),("out","/nix/store/3iq0cd1ll0c7hss8xxgalxqn0jm0b2mi-libXdmcp-1.1.2"),("outputs","out dev doc"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src","/nix/store/djf171kmvws6891q2nzd2icdjd5bgj4r-libXdmcp-1.1.2.tar.bz2"),("stdenv","/nix/store/985d95clq0216a6pcp3qzw4igp84ajvr-stdenv"),("system","x86_64-linux")])';
const parse = require("./lib");
try {
console.log(util.inspect(parse(testDerivation), {colors: true, depth: null}));
} catch (err) {
console.error(util.inspect(err, {colors: true}));
}
Promise.try(() => {
return fs.readFileAsync(process.argv[2]);
}).then((contents) => {
try {
console.log(util.inspect(parse(contents.toString()), {colors: true, depth: null}));
} catch (err) {
console.error(util.inspect(err, {colors: true}));
}
});

Loading…
Cancel
Save