Commit 323da22a authored by Matthieu Dorier's avatar Matthieu Dorier

corrected tests

parent 52634425
......@@ -110,8 +110,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(i*max_value_size/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......
......@@ -109,8 +109,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(i*max_value_size/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
for(unsigned i=0; i < num_keys; i += 2) {
const auto& k = keys[i];
ret = sdskv_erase(kvph, db_id,
(const void *)k.data(), k.size()+1);
(const void *)k.data(), k.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_erase() failed (key was %s)\n", k.c_str());
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -147,7 +147,7 @@ int main(int argc, char *argv[])
size_t value_size = max_value_size;
std::vector<char> v(max_value_size);
ret = sdskv_get(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)k.data(), k.size(),
(void *)v.data(), &value_size);
if(i % 2 == 0) { /* key is supposed to be erased */
if(ret == 0) {
......
......@@ -110,8 +110,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(3+i*(max_value_size-3)/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
size_t value_size = max_value_size;
std::vector<char> v(max_value_size);
ret = sdskv_get(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)k.data(), k.size(),
(void *)v.data(), &value_size);
if(ret != 0) {
fprintf(stderr, "Error: sdskv_get() failed (key was %s)\n", k.c_str());
......
......@@ -109,8 +109,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(rand() % max_value_size);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
auto k = keys[rand() % keys.size()];
size_t value_size = 0;
ret = sdskv_length(kvph, db_id,
(const void *)k.data(), k.size()+1, &value_size);
(const void *)k.data(), k.size(), &value_size);
if(ret != 0) {
fprintf(stderr, "Error: sdskv_length() failed (key was %s)\n", k.c_str());
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -140,9 +140,9 @@ int main(int argc, char *argv[])
margo_finalize(mid);
return -1;
}
if(value_size != reference[k].size()+1) {
if(value_size != reference[k].size()) {
fprintf(stderr, "Error: sdskv_length() returned a value different from the reference\n");
fprintf(stderr, " (expected %ld, got %ld)\n", reference[k].size()+1, value_size);
fprintf(stderr, " (expected %ld, got %ld)\n", reference[k].size(), value_size);
sdskv_shutdown_service(kvcl, svr_addr);
sdskv_provider_handle_release(kvph);
margo_addr_free(mid, svr_addr);
......
......@@ -117,8 +117,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(i*max_value_size/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......
......@@ -110,8 +110,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(i*max_value_size/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
std::cout << "Expecting " << max_keys << " keys after " << keys_after << std::endl;
ret = sdskv_list_keys(kvph, db_id,
(const void*)keys_after.c_str(), keys_after.size()+1,
(const void*)keys_after.c_str(), keys_after.size(),
list_result.data(), ksizes.data(), &max_keys);
if(ret != 0) {
......
......@@ -111,8 +111,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(i*max_value_size/num_keys);
ret = sdskv_put(kvph, db_id,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
if(ret != 0) {
fprintf(stderr, "Error: sdskv_put() failed (iteration %d)\n", i);
sdskv_shutdown_service(kvcl, svr_addr);
......@@ -135,8 +135,8 @@ int main(int argc, char *argv[])
auto keys_after = keys[i1-1];
hg_size_t max_keys = i2-i1;
std::vector<std::vector<char>> key_strings(max_keys, std::vector<char>(max_key_size+1));
std::vector<std::vector<char>> val_strings(max_keys, std::vector<char>(max_value_size+1));
std::vector<std::vector<char>> key_strings(max_keys, std::vector<char>(max_key_size));
std::vector<std::vector<char>> val_strings(max_keys, std::vector<char>(max_value_size));
std::vector<void*> keys_addr(max_keys);
std::vector<void*> vals_addr(max_keys);
std::vector<hg_size_t> ksizes(max_keys, max_key_size+1);
......@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
}
ret = sdskv_list_keyvals(kvph, db_id,
(const void*)keys_after.c_str(), keys_after.size()+1,
(const void*)keys_after.c_str(), keys_after.size(),
keys_addr.data(), ksizes.data(),
vals_addr.data(), vsizes.data(),
&max_keys);
......
......@@ -154,8 +154,8 @@ int main(int argc, char *argv[])
// half of the entries will be put using bulk
auto v = gen_random_string(3+i*(max_value_size-3)/num_keys);
ret = sdskv_put(kvphA, db_idA,
(const void *)k.data(), k.size()+1,
(const void *)v.data(), v.size()+1);
(const void *)k.data(), k.size(),
(const void *)v.data(), v.size());
keys.push_back(k);
data.push_back(v);
if(ret != 0) {
......@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
size_t value_size = max_value_size;
std::vector<char> v(max_value_size);
ret = sdskv_get(kvphB, db_idB,
(const void *)k.data(), k.size()+1,
(const void *)k.data(), k.size(),
(void *)v.data(), &value_size);
if(ret != SDSKV_SUCCESS) {
fprintf(stderr,"Error: sdskv_get() failed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment