diff --git a/tests/cachetest/tests/access-cache.c b/tests/cachetest/tests/access-cache.c deleted file mode 100644 index c5a44a850a487915da871db2a42d9e149257890a..0000000000000000000000000000000000000000 --- a/tests/cachetest/tests/access-cache.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "klib.h" - -int main() { - int round = 30; - static char arr[4 * 1024 * 1024]; - for (int i = 0; i < round; i++) - arr[i * 64] = i; - for (int i = 0; i < round; i++) - assert(arr[i * 64] == (char)i); - return 0; -} diff --git a/tests/cachetest/tests/access.c b/tests/cachetest/tests/access.c index c1629ad7fedbc58ceb57b49ffdae1b6dc3e72866..e0eb6693148e710213ef1229ad94c3ff07754691 100644 --- a/tests/cachetest/tests/access.c +++ b/tests/cachetest/tests/access.c @@ -1,12 +1,21 @@ #include "klib.h" -int ans[64] = {0}; +#define N 64 +#define CACHE_SIZE (32 * 1024) +int ans[2 * CACHE_SIZE / sizeof(int)] = {0}; int main() { int i = 0; - for (i = 0; i < 64; i++) - ans[i] = 64 - i; - for (i = 0; i < 64; i++) - assert(ans[i] == 64 - i); + for (i = 0; i < N; i++) + ans[i] = i; + + int start = CACHE_SIZE / sizeof(int); + for (i = 0; i < N; i++) + ans[start + i] = start + i; + + for (i = 0; i < N; i++) { + assert(ans[i] == i); + assert(ans[start + i] == start + i); + } return 0; }