Do feature testing before running misc subtests

This commit is contained in:
Hannes Verschore 2015-02-02 16:44:38 +01:00
Родитель b1b32d56c4
Коммит 02b7fe3490
12 изменённых файлов: 109 добавлений и 90 удалений

Просмотреть файл

@ -21,7 +21,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var count = output.length;
@ -62,8 +62,17 @@ function initialize()
testStdErrsByCategory[category] = {};
}
for (var i = 0; i < tests.length; i++) {
var test = tests[i];
// The list of tests that got run can be lower than the list of tests tried to run.
// So take the former if we have atleast on result.
var inputs = tests;
if (output.length > 0) {
inputs = [];
for (var test in output[0])
inputs[inputs.length] = test;
}
for (var i = 0; i < inputs.length; i++) {
var test = inputs[i];
itemTotals[test] = [];
var category = test.replace(/-.*/, "");
testTotalsByCategory[category][test] = 0;
@ -229,7 +238,7 @@ function resultLine(labelWidth, indent, label, meanWidth, mean, stdErr)
for (i = 0; i < indent; i++) {
result += " ";
}
if (label in explanations)
result += "<a href='" + explanations[label] + "'>" + label + "</a>: ";
else
@ -238,7 +247,7 @@ function resultLine(labelWidth, indent, label, meanWidth, mean, stdErr)
for (i = 0; i < (labelWidth - (label.length + indent)); i++) {
result += " ";
}
return result + formatResult(meanWidth, mean, stdErr, count);
}

Просмотреть файл

@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var results = new Array();
@ -29,9 +29,18 @@ var time = 0;
var times = [];
times.length = tests.length;
for (var krakenCounter = 0; krakenCounter < tests.length; krakenCounter++) {
for (var krakenCounter = 0; krakenCounter < tests.length; krakenCounter++) {
var testBase = "tests/" + suiteName + "/" + tests[krakenCounter];
var testName = testBase + ".js";
var shouldrun = true;
try {
if (this.loadRelativeToCwd)
loadRelativeToCwd(testBase + "-shouldrun.js");
else
load(testBase + "-shouldrun.js");
} catch(e) {}
if (!shouldrun)
continue;
try {
if (this.loadRelativeToCwd)
loadRelativeToCwd(testBase + "-data.js");
@ -52,7 +61,8 @@ function recordResults(tests, times)
var output = "{\n";
for (j = 0; j < tests.length; j++) {
output += ' "' + tests[j] + '": ' + times[j] + ',\n';
if (typeof times[j] !== "undefined")
output += ' "' + tests[j] + '": ' + times[j] + ',\n';
}
output = output.substring(0, output.length - 2) + "\n";

Просмотреть файл

@ -0,0 +1,3 @@
// only run this test in spidermonkey. V8 and JSC are really bad at this.
if (typeof snarf === "undefined")
shouldrun = false;

Просмотреть файл

@ -1,4 +1,3 @@
// http://my.opera.com/emoller/blog/2011/05/01/javascript-performance
// bug 659467
function foo() {
@ -9,7 +8,4 @@ function foo() {
dest += dest[i];
}
}
// only run this test in spidermonkey. V8 and JSC are really bad at this.
if (typeof snarf != "undefined")
foo();
foo();

Просмотреть файл

@ -0,0 +1,2 @@
if (typeof TypedObject === "undefined")
shouldrun = false;

Просмотреть файл

@ -1,34 +1,32 @@
// Paired with misc-typedobj-simple-struct-standard.js
if (typeof TypedObject != "undefined") {
var T = TypedObject;
var T = TypedObject;
var Struct = new T.StructType({a: T.int32, b:T.int32});
var ObjectArray = T.Object.array(100000);
var Struct = new T.StructType({a: T.int32, b:T.int32});
var ObjectArray = T.Object.array(100000);
function do_test() {
var arr1 = new ObjectArray();
var arr2 = new ObjectArray();
for (var i = 0; i < arr1.length; i++) {
arr1[i] = new Struct();
arr1[i].a = 1;
arr1[i].b = 2;
arr2[i] = new Struct();
arr2[i].a = 2;
arr2[i].b = 1;
}
for (var i = 0; i < 100; i++) {
for (var j = 0; j < arr1.length; j++) {
var a = arr1[j].a;
var b = arr1[j].b;
arr1[j].a = arr2[j].b;
arr1[j].b = arr2[j].a;
arr2[j].a = a;
arr2[j].b = b;
}
}
function do_test() {
var arr1 = new ObjectArray();
var arr2 = new ObjectArray();
for (var i = 0; i < arr1.length; i++) {
arr1[i] = new Struct();
arr1[i].a = 1;
arr1[i].b = 2;
arr2[i] = new Struct();
arr2[i].a = 2;
arr2[i].b = 1;
}
do_test();
for (var i = 0; i < 100; i++) {
for (var j = 0; j < arr1.length; j++) {
var a = arr1[j].a;
var b = arr1[j].b;
arr1[j].a = arr2[j].b;
arr1[j].b = arr2[j].a;
arr2[j].a = a;
arr2[j].b = b;
}
}
}
do_test();

Просмотреть файл

@ -0,0 +1,2 @@
if (typeof TypedObject === "undefined")
shouldrun = false;

Просмотреть файл

@ -38,15 +38,13 @@ var kSplayTreePayloadDepth = 5;
var splayTree = null;
if (typeof TypedObject != "undefined") {
var T = TypedObject;
var T = TypedObject;
var kPayloadArrayType = T.int32.array(4);
var kPayloadStructType = new T.StructType({array: T.Object, string: T.string});
var kPayloadTreeType = new T.StructType({left: T.Object, right: T.Object});
var kSplayTreeNodeType = new T.StructType({key: T.float64, value: T.Object,
left: T.Object, right: T.Object});
}
var kPayloadArrayType = T.int32.array(4);
var kPayloadStructType = new T.StructType({array: T.Object, string: T.string});
var kPayloadTreeType = new T.StructType({left: T.Object, right: T.Object});
var kSplayTreeNodeType = new T.StructType({key: T.float64, value: T.Object,
left: T.Object, right: T.Object});
function GeneratePayloadTree(depth, tag) {
var res;

Просмотреть файл

@ -0,0 +1,2 @@
if (typeof TypedObject === "undefined")
shouldrun = false;

Просмотреть файл

@ -16,6 +16,5 @@ function do_test() {
}
}
}
if (typeof TypedObject != "undefined")
do_test();
do_test();

Просмотреть файл

@ -0,0 +1,2 @@
if (typeof TypedObject === "undefined")
shouldrun = false;

Просмотреть файл

@ -1,42 +1,40 @@
// Paired with misc-typedobj-write-struct-field-standard.js
if (typeof TypedObject != "undefined") {
var T = TypedObject;
var ThreeVector = T.float64.array(3);
var DisplaceResult = new T.StructType({pos: ThreeVector, nor: ThreeVector});
function write(out, v0) {
out.pos[0] = v0[0];
out.pos[1] = v0[1];
out.pos[2] = v0[2];
out.nor[0] += v0[0];
out.nor[1] += v0[1];
out.nor[2] += v0[2];
}
function main() {
var start_time, end_time;
var p = new DisplaceResult();
var v = [1, 2, 3];
var len = 192 * 10 * 1024;
if (typeof TIME !== "undefined")
start_time = Date.now();
for (var i = 0; i < len; i++) {
v[0] = i+0.5;
v[1] = i+1.5;
v[2] = i+2.5;
write(p, v);
}
if (typeof TIME !== "undefined") {
end_time = Date.now();
print("Elapsed:", (end_time - start_time));
}
}
main();
var T = TypedObject;
var ThreeVector = T.float64.array(3);
var DisplaceResult = new T.StructType({pos: ThreeVector, nor: ThreeVector});
function write(out, v0) {
out.pos[0] = v0[0];
out.pos[1] = v0[1];
out.pos[2] = v0[2];
out.nor[0] += v0[0];
out.nor[1] += v0[1];
out.nor[2] += v0[2];
}
function main() {
var start_time, end_time;
var p = new DisplaceResult();
var v = [1, 2, 3];
var len = 192 * 10 * 1024;
if (typeof TIME !== "undefined")
start_time = Date.now();
for (var i = 0; i < len; i++) {
v[0] = i+0.5;
v[1] = i+1.5;
v[2] = i+2.5;
write(p, v);
}
if (typeof TIME !== "undefined") {
end_time = Date.now();
print("Elapsed:", (end_time - start_time));
}
}
main();