chore(tests/lean/caching_user_attribute): fix flaky test

This commit is contained in:
Sebastian Ullrich 2017-03-29 13:38:48 +02:00 committed by Gabriel Ebner
parent 8e36d6304d
commit b2dfae8a67
3 changed files with 11 additions and 37 deletions

View file

@ -24,23 +24,6 @@ Author: Sebastian Ullrich
namespace lean {
/* typed_attribute */
struct user_attr_data : public attr_data {
// to be filled
void write(serializer &) const {
lean_unreachable();
}
void read(deserializer &) {
lean_unreachable();
}
};
class user_attribute : public typed_attribute<user_attr_data> {
public:
user_attribute(name const & id, char const * descr) : typed_attribute(id, descr) {}
};
/* Persisting */
struct user_attr_ext : public environment_extension {
name_map<attribute_ptr> m_attrs;
@ -74,7 +57,7 @@ static environment add_user_attr(environment const & env, name const & d) {
std::string descr = to_string(cfield(o, 1));
user_attr_ext ext = get_extension(env);
ext.m_attrs.insert(n, attribute_ptr(new user_attribute(n, descr.c_str())));
ext.m_attrs.insert(n, attribute_ptr(new basic_attribute(n, descr.c_str())));
return update(env, ext);
}

View file

@ -10,21 +10,12 @@ set_option trace.user_attributes_cache true
run_cmd do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
run_cmd do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
attribute [foo] eq.mpr
local attribute [-foo] eq.mp
run_cmd do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
attribute [reducible] eq.mp -- should not affect [foo] cache
run_cmd do
tactic.trace s,
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s,
tactic.set_basic_attribute `foo ``eq.mpr,
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s,
tactic.set_basic_attribute `reducible ``eq.mp, -- should not affect [foo] cache
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s

View file

@ -3,16 +3,16 @@
eq.refl
eq.mp
[user_attributes_cache] no cached result for [foo]
[user_attributes_cache] recomputing cache for [foo]
eq.refl
eq.mp
[user_attributes_cache] no cached result for [foo]
[user_attributes_cache] cached result for [foo] has been found, but cache fingerprint does not match
[user_attributes_cache] recomputing cache for [foo]
eq.refl
eq.mp
eq.mpr
eq.refl
eq.mp
eq.mpr