Improve symbols test

Remove seed argument and check for disallowed undefined symbols
This commit is contained in:
2024-01-30 11:46:03 -08:00
parent 3735a43553
commit eca1b9993a
7 changed files with 17 additions and 9 deletions

View File

@@ -820,7 +820,7 @@ void ConflictSet::setOldestVersion(int64_t oldestVersion) {
return impl->setOldestVersion(oldestVersion);
}
ConflictSet::ConflictSet(int64_t oldestVersion, [[maybe_unused]] uint64_t seed)
ConflictSet::ConflictSet(int64_t oldestVersion)
: impl(new (safe_malloc(sizeof(Impl))) Impl{oldestVersion}) {}
ConflictSet::~ConflictSet() {
@@ -859,7 +859,7 @@ ConflictSet_setOldestVersion(void *cs, int64_t oldestVersion) {
((ConflictSet::Impl *)cs)->setOldestVersion(oldestVersion);
}
__attribute__((__visibility__("default"))) void *
ConflictSet_create(int64_t oldestVersion, uint64_t) {
ConflictSet_create(int64_t oldestVersion) {
return new (safe_malloc(sizeof(ConflictSet::Impl)))
ConflictSet::Impl{oldestVersion};
}
@@ -870,6 +870,8 @@ __attribute__((__visibility__("default"))) void ConflictSet_destroy(void *cs) {
}
}
namespace {
void printLogical(std::string &result, Node *node) {
Arena arena;
for (Node *iter = node; iter != nullptr;) {
@@ -982,6 +984,8 @@ bool checkCorrectness(Node *node, ReferenceImpl &refImpl) {
return success;
}
} // namespace
namespace std {
void __throw_length_error(const char *) { __builtin_unreachable(); }
} // namespace std

View File

@@ -448,6 +448,8 @@ inline std::string printable(const Key &key) {
return printable(std::string_view((const char *)key.p, key.len));
}
namespace {
template <class ConflictSetImpl> struct TestDriver {
// TODO call setOldestVersion, and check range writes/reads
Arbitrary arbitrary;
@@ -538,5 +540,6 @@ template <class ConflictSetImpl> struct TestDriver {
return false;
}
};
} // namespace
// GCOVR_EXCL_STOP

View File

@@ -3,7 +3,7 @@
#include <assert.h>
int main(void) {
ConflictSet *cs = ConflictSet_create(0, 0);
ConflictSet *cs = ConflictSet_create(0);
ConflictSet_WriteRange w;
ConflictSet_Result result;
ConflictSet_ReadRange r;

View File

@@ -3,7 +3,7 @@
#include <cassert>
int main(void) {
ConflictSet cs(0, 0);
ConflictSet cs(0);
ConflictSet::WriteRange w;
w.begin.p = (const uint8_t *)"0000";
w.begin.len = 4;

View File

@@ -52,7 +52,7 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
/** Reads where readVersion < oldestVersion will result in `TooOld`. There are
* no writes initially. */
explicit ConflictSet(int64_t oldestVersion, uint64_t seed);
explicit ConflictSet(int64_t oldestVersion);
~ConflictSet();
#if __cplusplus > 199711L
@@ -121,7 +121,7 @@ void ConflictSet_addWrites(ConflictSet *cs,
void ConflictSet_setOldestVersion(ConflictSet *cs, int64_t oldestVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. There are
* no writes initially. */
ConflictSet *ConflictSet_create(int64_t oldestVersion, uint64_t seed);
ConflictSet *ConflictSet_create(int64_t oldestVersion);
void ConflictSet_destroy(ConflictSet *cs);
#endif

View File

@@ -6,9 +6,9 @@ ConflictSet_setOldestVersion
_ZN11ConflictSet16setOldestVersionEl
_ZN11ConflictSet9addWritesEPKNS_10WriteRangeEi
_ZN11ConflictSetaSEOS_
_ZN11ConflictSetC1Elm
_ZN11ConflictSetC1El
_ZN11ConflictSetC1EOS_
_ZN11ConflictSetC2Elm
_ZN11ConflictSetC2El
_ZN11ConflictSetC2EOS_
_ZN11ConflictSetD1Ev
_ZN11ConflictSetD2Ev

View File

@@ -2,4 +2,5 @@
set -euo pipefail
diff -u <(nm $1 | grep " T " | cut -f3 -d " " | sort) $2
diff -u "$2" <(nm "$1" | grep " T " | cut -f3 -d " " | sort)
nm "$1" | grep " U " | (! grep -Pv 'abort|free|malloc|mem[a-z]*')