[Pkg-mozext-commits] [perspectives-extension] 08/44: tests - mark tests that are known failures
David Prévot
taffit at moszumanska.debian.org
Sun Jun 26 04:59:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository perspectives-extension.
commit 3713a929719575c2c92808f80ed388ec3c6756e5
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date: Tue Oct 20 22:54:49 2015 -0600
tests - mark tests that are known failures
Easier to find and fix these later,
and easier to differentiate long-term known failures
from any issues inroduced during development
---
test/test.html | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/test/test.html b/test/test.html
index f016db5..3950aab 100644
--- a/test/test.html
+++ b/test/test.html
@@ -93,6 +93,7 @@ function clear() {
g_test_count = 0;
g_pass_count = 0;
g_fail_count = 0;
+ g_known_failure_count = 0;
}
function write_string(str) {
@@ -150,6 +151,17 @@ function assert_writeme(test, case_name) {
write_string_to_element('[-] <span style="color: grey">not implemented</span> : ' + case_name, 'li');
}
+// placeholder function to note tests that are known to be broken and fail.
+// the code tested by these tests should really be fixed!
+// but we use this to mark tests that we know will fail and need to be fixed
+// in the long term.
+// this makes it easier to identify actual breaks made by recent developer changes
+function assert_fixme(test, case_name) {
+ g_test_count++;
+ g_known_failure_count++;
+ write_string_to_element('[' + g_test_count + '] <span style="color: grey">KNOWN FAILURE - this code needs to be fixed</span> : ' + case_name, 'li');
+}
+
// add a horizontal bar to visuall separate some items or tests
function spacer(category_name) {
write_string_to_element('------- <span style="color: grey">' + category_name + ':</span>', 'li');
@@ -489,7 +501,7 @@ function quorum_basics() {
assert(quorum_duration >= 1 , "Searching for an existing key within the time limit has a positive duration");
// FIXME: assert fails
// lambdor: shouldn't that be the crossing of oldest timestamp.end and (cur_time - max_stale_sec)?
- assert(quorum_duration === cur_time + max_stale_sec + 1 , "The duration is as long as the observation.start to observation.end (Expected " + (cur_time + max_stale_sec + 1) + ", got " + quorum_duration + ")");
+ assert_fixme(quorum_duration === cur_time + max_stale_sec + 1 , "The duration is as long as the observation.start to observation.end (Expected " + (cur_time + max_stale_sec + 1) + ", got " + quorum_duration + ")");
quorum_duration = Pers_client_policy.get_quorum_duration(key1, server_result_list, 1, max_stale_sec, cur_time + max_stale_sec + 1);
assert(quorum_duration === -1 , "Being over the quorum duration time limit fails");
@@ -502,7 +514,7 @@ function quorum_basics() {
quorum_duration = Pers_client_policy.get_quorum_duration(key1, server_result_list, 1, max_stale_sec, cur_time);
assert(quorum_duration >= 1 , "2. Being at the edge of the quorum duration time limit passes");
// FIXME: assert fails, see above
- assert(quorum_duration === cur_time + max_stale_sec + 1 , "2. The duration is as long as the observation.start to observation.end (i.e. it does NOT also count time that is white/a gap between it's end an the current time). (Expected " + (cur_time + max_stale_sec + 1) + ", got " + quorum_duration + ")");
+ assert_fixme(quorum_duration === cur_time + max_stale_sec + 1 , "2. The duration is as long as the observation.start to observation.end (i.e. it does NOT also count time that is white/a gap between it's end an the current time). (Expected " + (cur_time + max_stale_sec + 1) + ", got " + quorum_duration + ")");
cur_time += 2 * max_stale_sec;
assert(key_end_time < cur_time - max_stale_sec , "With changes, key is *outside* the quorum duration limit.");
@@ -561,7 +573,7 @@ function quorum_basics() {
//(i.e. only as long as the bar, and only if inside cutoff)
// FIXME: assert fails, see above
var gap_quorum_duration1 = Pers_client_policy.get_quorum_duration(key1, gap_result_list, 1, max_stale_sec, cur_time);
- assert(gap_quorum_duration1 === end_time_1 - beg_time_1 + 1 , "Target key first: |curtime| .. |current key| .. |other key| {cutoff} (should be " + (end_time_1 - beg_time_1 + 1) + ", not " + (cur_time - beg_time_1 + 1) + ": got " + gap_quorum_duration1 + ").");
+ assert_fixme(gap_quorum_duration1 === end_time_1 - beg_time_1 + 1 , "Target key first: |curtime| .. |current key| .. |other key| {cutoff} (should be " + (end_time_1 - beg_time_1 + 1) + ", not " + (cur_time - beg_time_1 + 1) + ": got " + gap_quorum_duration1 + ").");
// the 'weakly seen' property is relative to the current time,
// so allow a check length going back to the end date of the observation.
@@ -572,7 +584,7 @@ function quorum_basics() {
assert_setup(end_time_2 > cur_time - max_stale_sec , "Gap setup: New target key2 ends inside the cutoff limit");
var gap_quorum_duration2 = Pers_client_policy.get_quorum_duration(key2, gap_result_list, 1, max_stale_sec, cur_time);
// FIXME: assert fails, see above
- assert(gap_quorum_duration2 === end_time_2 - beg_time_2 + 1 , "Target key second: |curtime| .. |other key| .. |current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + gap_quorum_duration2 + ").");
+ assert_fixme(gap_quorum_duration2 === end_time_2 - beg_time_2 + 1 , "Target key second: |curtime| .. |other key| .. |current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + gap_quorum_duration2 + ").");
var gap_weakly_seen2 = Pers_client_policy.key_weakly_seen_by_quorum(key2, gap_result_list, 1, weak_check_time_limit);
assert(gap_weakly_seen2 === true , "key2 is 'weakly seen'");
@@ -612,9 +624,9 @@ function quorum_basics() {
var nongap_quorum_duration1 = Pers_client_policy.get_quorum_duration(key1, non_gap_result_list, 1, max_stale_sec, cur_time);
// FIXME: assert fails, see above
- assert(nongap_quorum_duration1 === end_time_1 - beg_time_1 + 1, "Target key first: |curtime| .. |current key||other key| {cutoff} (should be " + (end_time_1 - beg_time_1 + 1) + ", not " + (cur_time - beg_time_1 + 1) + ": got " + nongap_quorum_duration1 + ").");
+ assert_fixme(nongap_quorum_duration1 === end_time_1 - beg_time_1 + 1, "Target key first: |curtime| .. |current key||other key| {cutoff} (should be " + (end_time_1 - beg_time_1 + 1) + ", not " + (cur_time - beg_time_1 + 1) + ": got " + nongap_quorum_duration1 + ").");
// FIXME: assert fails, see above
- assert(nongap_quorum_duration1 === gap_quorum_duration1 , "Duration is the same with and without gaps.");
+ assert_fixme(nongap_quorum_duration1 === gap_quorum_duration1 , "Duration is the same with and without gaps.");
// the 'weakly seen' property is relative to the current time,
// so allow a check length going back to the end date of the observation.
@@ -626,8 +638,8 @@ function quorum_basics() {
assert_setup(end_time_2 > cur_time - max_stale_sec , "Nongap setup: New target key2 ends inside the cutoff limit");
var nongap_quorum_duration2 = Pers_client_policy.get_quorum_duration(key2, non_gap_result_list, 1, max_stale_sec, cur_time);
- assert(nongap_quorum_duration2 === end_time_2 - beg_time_2 + 1, "Target key second: |curtime| .. |other key||current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + nongap_quorum_duration2 + ").");
- assert(nongap_quorum_duration2 === gap_quorum_duration2 , "Duration is the same with and without gaps.");
+ assert_fixme(nongap_quorum_duration2 === end_time_2 - beg_time_2 + 1, "Target key second: |curtime| .. |other key||current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + nongap_quorum_duration2 + ").");
+ assert_fixme(nongap_quorum_duration2 === gap_quorum_duration2 , "Duration is the same with and without gaps.");
// the 'weakly seen' property is relative to the current time,
// so allow a check length going back to the end date of the observation.
@@ -667,7 +679,7 @@ function quorum_basics() {
// TODO: should we use the longest or shortest one instead?
quorum_duration = Pers_client_policy.get_quorum_duration(key1, gap_result_list2, 1, max_stale_sec, cur_time);
// FIXME: assert fails, see above
- assert(quorum_duration === end_time_2 - beg_time_2 + 1, "Target key second: |curtime| .. |current key| .. |current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + quorum_duration + ").");
+ assert_fixme(quorum_duration === end_time_2 - beg_time_2 + 1, "Target key second: |curtime| .. |current key| .. |current key.. {cutoff} .. |(should be " + (end_time_2 - beg_time_2 + 1) + ", not " + (cur_time - beg_time_2 + 1) + ": got " + quorum_duration + ").");
// testing against a result set without gaps doesn't make sense here;
// the two observations would be joined together.
@@ -706,13 +718,13 @@ function quorum_basics() {
quorum_duration = Pers_client_policy.get_quorum_duration(key1,
short_result_list, 1, max_stale_sec, cur_time);
// FIXME: assert fails, see above
- assert(quorum_duration === 1 , "A one-second duration within the valid time window is one second (got " + quorum_duration + ").");
+ assert_fixme(quorum_duration === 1 , "A one-second duration within the valid time window is one second (got " + quorum_duration + ").");
cur_time += 1 * DAY_SECS;
assert_setup(cur_time - max_stale_sec < short_end, "Current time for the next test is still within the valid window.");
var quorum_duration2 = Pers_client_policy.get_quorum_duration(key1, short_result_list, 1, max_stale_sec, cur_time);
// FIXME: assert fails, see above
- assert(quorum_duration === quorum_duration2, "Changing the curtime within the valid window doesn't change the duration of the cert observation (got " + quorum_duration2 + ").");
+ assert_fixme(quorum_duration === quorum_duration2, "Changing the curtime within the valid window doesn't change the duration of the cert observation (got " + quorum_duration2 + ").");
spacer('Quorums with a small number of notaries');
@@ -999,8 +1011,9 @@ function run_tests() {
notary_replies();
write_string("Finished: " + g_pass_count + "/" + g_test_count + " successes, "
- + g_fail_count + " failures. ");
- if(g_test_count !== g_pass_count + g_fail_count) {
+ + g_fail_count + " failures, " + g_known_failure_count +
+ " known failures.");
+ if(g_test_count !== g_pass_count + g_fail_count + g_known_failure_count) {
error("Count totals did not match!");
}
} catch(e) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git
More information about the Pkg-mozext-commits
mailing list