From fef355423b8d968f8e361cf13f890c0c672010f2 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 1 Jan 2022 15:14:44 +0800 Subject: [PATCH] fix CI red herrings; add more debug granularty --- services/pddb/src/backend/basis.rs | 2 +- services/pddb/src/backend/dictionary.rs | 4 ++-- services/pddb/src/tests.rs | 13 ++++++++++--- tools/pddbci.py | 24 +++++++++++------------- tools/pddbdbg.py | 8 ++++++-- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/services/pddb/src/backend/basis.rs b/services/pddb/src/backend/basis.rs index f6388a95d..5a98bab08 100644 --- a/services/pddb/src/backend/basis.rs +++ b/services/pddb/src/backend/basis.rs @@ -655,7 +655,7 @@ impl BasisCache { return Err(Error::new(ErrorKind::NotFound, "Requested basis not found, or PDDB not mounted.")); } // make the reservation - log::info!("reserving {} pages - {}", pages_needed, reserved_pages); + log::debug!("reserving {} pages - {}", pages_needed, reserved_pages); if !hw.ensure_fast_space_alloc(pages_needed, &self.cache) { return Err(Error::new(ErrorKind::OutOfMemory, "No free space to allocate dict")); } diff --git a/services/pddb/src/backend/dictionary.rs b/services/pddb/src/backend/dictionary.rs index 356af7b74..e9dba38b6 100644 --- a/services/pddb/src/backend/dictionary.rs +++ b/services/pddb/src/backend/dictionary.rs @@ -403,7 +403,7 @@ impl DictCacheEntry { } // the key exists, *and* there's sufficient space for the data if kcache.start < SMALL_POOL_END { - log::debug!("doing data update"); + log::debug!("doing data update of {}", name); kcache.age = kcache.age.saturating_add(1); kcache.clean = false; // it's a small key; note that we didn't consult the *size* of the key to determine its pool type: @@ -534,7 +534,7 @@ impl DictCacheEntry { // key does not exist (or was previously erased) -- create one or replace the erased one. // try to fit the key in the small pool first if ((data.len() + offset) < SMALL_CAPACITY) && (alloc_hint.unwrap_or(0) < SMALL_CAPACITY) { - log::debug!("creating small key"); + log::debug!("creating small key {}", name); // handle the case that we're a brand new dictionary and no small keys have ever been stored before. if self.small_pool.len() == 0 { self.small_pool.push(KeySmallPool::new()); diff --git a/services/pddb/src/tests.rs b/services/pddb/src/tests.rs index d1b6fa63e..54fbb76cb 100644 --- a/services/pddb/src/tests.rs +++ b/services/pddb/src/tests.rs @@ -281,6 +281,14 @@ pub(crate) fn delete_pattern(hw: &mut PddbOs, basis_cache: &mut BasisCache, for dictname in evicted_dicts.iter() { let (keyname, keydata) = gen_key(dictname, keynum, key_lower_bound, key_upper_bound); // now we're ready to write it out + match basis_cache.key_attributes(hw, dictname, &keyname, None) { + Ok(ka) => { + log::warn!("rng collision on keygen: {}, deleting key", keyname); + basis_cache.key_remove(hw, dictname, &keyname, None, false)?; + } + _ => { + } + } if maybe_extra_reserved.is_none() { // we do this slightly funky way instead of just passing Some(0) because we want to test the "None" path explicitly basis_cache.key_update(hw, dictname, &keyname, &keydata, None, @@ -400,18 +408,18 @@ pub(crate) fn ci_tests(pddb_os: &mut PddbOs) -> Result<()> { log::info!("Doing delete/add consistency with data extension"); delete_add_dict_consistency(pddb_os, &mut basis_cache, None, None, None, None, None)?; - log::set_max_level(log::LevelFilter::Debug); log::info!("Saving `dachecke` to local host"); pddb_os.dbg_dump(Some("dachecke".to_string()), None); log::info!("Doing patch test"); patch_test(pddb_os, &mut basis_cache, None, None, true)?; pddb_os.dbg_dump(Some("patche".to_string()), None); - log::set_max_level(log::LevelFilter::Info); + log::set_max_level(log::LevelFilter::Debug); log::info!("Doing delete pattern test"); delete_pattern(pddb_os, &mut basis_cache, None, None, None, None)?; pddb_os.dbg_dump(Some("patterne".to_string()), None); + log::set_max_level(log::LevelFilter::Info); // extended tests. // allocation space curtailed to force resource exhaustion faster. @@ -519,7 +527,6 @@ pub(crate) fn ci_tests(pddb_os: &mut PddbOs) -> Result<()> { assert!(merge2_list.difference(&merge_list).count() == 0, "merged list is different from the original list after remount"); list_all(pddb_os, &mut basis_cache); - log::set_max_level(log::LevelFilter::Debug); log::info!("CI done"); Ok(()) } diff --git a/tools/pddbci.py b/tools/pddbci.py index b9d607a9c..088319ebd 100644 --- a/tools/pddbci.py +++ b/tools/pddbci.py @@ -23,7 +23,7 @@ def main(): pass_log = {} err_log = [] - for seed in range(0, 201): + for seed in range(200, 401): err_log.append("Starting seed {}".format(seed)) seed_env = os.environ seed_env["XOUS_SEED"] = str(seed) @@ -34,7 +34,7 @@ def main(): # logging.info(line) start_time = time.time() - passing = True + passing = 'PASS' proc = subprocess.Popen( ['cargo', 'xtask', 'run'], stdout=subprocess.PIPE, @@ -49,7 +49,7 @@ def main(): proc.kill() if time.time() - start_time > 20: logging.debug("timeout on generation") - passing = False + passing = 'FAIL TIMEOUT' break if realtime_output: if 'Seed' in realtime_output: @@ -61,16 +61,18 @@ def main(): err_log.append(realtime_output) logging.debug("ran out of space") # passing = False # not a fail, because it's the test condition that's wrong, not the code + passing = 'OOM' proc.kill() if "couldn't allocate memory" in realtime_output: err_log.append(realtime_output) logging.debug("ran out of space") # passing = False # not a fail, because it's the test condition that's wrong, not the code + passing = 'OOM' proc.kill() if 'Decryption auth error' in realtime_output: err_log.append(realtime_output) logging.debug("decryption auth error") - passing = False + passing = 'FAIL AUTH' proc.kill() proc = subprocess.Popen( @@ -84,7 +86,7 @@ def main(): realtime_output = proc.stdout.readline() if (realtime_output == '' and proc.poll() is not None) or (time.time() - start_time > 45): if time.time() - start_time > 45: - passing = False + passing = 'FAIL ANALYSIS TIMEOUT' logging.debug("analysis timed out") proc.kill() break @@ -93,19 +95,15 @@ def main(): logging.info(realtime_output.strip()) err_log.append(realtime_output) logging.debug("output contained errors") - passing = False + passing = 'FAIL CI ERRORS' if 'WARNING' in realtime_output: logging.info(realtime_output.strip()) err_log.append(realtime_output) logging.debug("output contained warnings") - passing = False + passing = 'FAIL CI WARNINGS' - if passing: - logging.info("Seed {} PASS".format(seed)) - pass_log[seed] = 'PASS' - else: - logging.info("Seed {} FAIL".format(seed)) - pass_log[seed] = 'FAIL' + logging.info("Seed {} {}".format(seed, passing)) + pass_log[seed] = passing for line in err_log: logging.info(line) diff --git a/tools/pddbdbg.py b/tools/pddbdbg.py index e8d4b66d1..904e0f186 100755 --- a/tools/pddbdbg.py +++ b/tools/pddbdbg.py @@ -443,8 +443,12 @@ class BasisDicts: if namecheck[1] != self.name: logging.warning(" Key/dict mismatch: {}/{}".format(key.name, self.name)) keylen = int(namecheck[3][3:]) - if keylen != key.len and keylen + 4 != key.len: # the second case is what happens with the length extension test, it's actually not an error - logging.warning(" Key named len vs disk len mismatch: {}/{}".format(keylen, key.len)) + if keylen > 12: + if keylen != key.len and keylen + 4 != key.len: # the second case is what happens with the length extension test, it's actually not an error + logging.warning(" Key named len vs disk len mismatch: {}/{}".format(keylen, key.len)) + else: + if key.len != 17: + logging.warning(" Key named len vs disk len mismatch: {}/{} (extension did not work correctly)".format(keylen, key.len)) if key.ci_ok == False: logging.warning(" CI failed on key {}:".format(name)) logging.warning(key.as_str(' '))