X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fllapi_hsm_test.c;h=2d4ab13ca69a6b8b3ecbaf61050ce3ef2285f57a;hb=d137e9823ca1e97fccee59913d5a7bf1891b825a;hp=01a701c98afb2cc2750d40f1a1e69d6c41e49bdc;hpb=3bfb6107ba4e92d8aa02e842502bc44bac7b8b43;p=fs%2Flustre-release.git diff --git a/lustre/tests/llapi_hsm_test.c b/lustre/tests/llapi_hsm_test.c index 01a701c..2d4ab13 100644 --- a/lustre/tests/llapi_hsm_test.c +++ b/lustre/tests/llapi_hsm_test.c @@ -201,7 +201,7 @@ int test5(void) /* Hopefully there is nothing lingering */ for (i = 0; i < 1000; i++) { rc = llapi_hsm_copytool_recv(ctdata, &hal, &msgsize); - ASSERTF(rc == -EWOULDBLOCK, "llapi_hsm_copytool_recv error: %s", + ASSERTF(rc == -EAGAIN, "llapi_hsm_copytool_recv error: %s", strerror(-rc)); } @@ -272,7 +272,7 @@ int test7(void) rc, strerror(errno)); rc = llapi_hsm_copytool_recv(ctdata, &hal, &msgsize); - ASSERTF(rc == -EWOULDBLOCK, "llapi_hsm_copytool_recv error: %s", + ASSERTF(rc == -EAGAIN, "llapi_hsm_copytool_recv error: %s", strerror(-rc)); fds[0].fd = fd; @@ -1021,6 +1021,41 @@ void test112(void) helper_archiving(test112_progress, length); } +/* Archive, with 9 reports, each covering 20%, so many overlap. */ +static void test113_progress(struct hsm_copyaction_private *hcp, size_t length) +{ + int rc; + int i; + struct hsm_extent he; + struct hsm_current_action hca; + + for (i = 0; i < 9; i++) { + he.offset = i*length/10; + he.length = 2*length/10; + rc = llapi_hsm_action_progress(hcp, &he, length, 0); + ASSERTF(rc == 0, "llapi_hsm_action_progress failed: %s", + strerror(-rc)); + + rc = llapi_hsm_current_action(testfile, &hca); + ASSERTF(rc == 0, "llapi_hsm_current_action failed: %s", + strerror(-rc)); + ASSERTF(hca.hca_state == HPS_RUNNING, + "hca_state=%u", hca.hca_state); + ASSERTF(hca.hca_action == HUA_ARCHIVE, + "hca_state=%u", hca.hca_action); + ASSERTF(hca.hca_location.length == (i+2)*length/10, + "i=%d, length=%llu", + i, (unsigned long long)hca.hca_location.length); + } +} + +void test113(void) +{ + const size_t length = 1000; + + helper_archiving(test113_progress, length); +} + static void usage(char *prog) { fprintf(stderr, "Usage: %s [-d lustre_dir]\n", prog); @@ -1091,6 +1126,7 @@ int main(int argc, char *argv[]) PERFORM(test110); PERFORM(test111); PERFORM(test112); + PERFORM(test113); return EXIT_SUCCESS; }