Skip to content

Commit

Permalink
testsuite: Reduce log verbosity, more readable test report, touch up …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
rdmark committed Oct 21, 2024
1 parent b4817eb commit a757160
Show file tree
Hide file tree
Showing 87 changed files with 1,626 additions and 1,542 deletions.
84 changes: 34 additions & 50 deletions test/testsuite/Error.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ unsigned int ret;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:test36: no folder error (ERR_NOOBJ)\n");
memset(dsi->commands, 0, sizeof(dsi->commands));
did = FPCreateDir(Conn,vol, DIRDID_ROOT , name);
if (!did) {
Expand Down Expand Up @@ -75,12 +73,14 @@ unsigned int ret;
my_dsi_cmd_receive(dsi);
ret = dsi->header.dsi_code;
if (ntohl(AFPERR_NOOBJ) != ret) {
if (!Quiet) {
fprintf(stdout,"\tFAILED command %3i %s\t result %d %s\n", cmd, AfpNum2name(cmd),ntohl(ret), afp_error(ret));
}
failed_nomsg();
}
}
test_exit:
exit_test("test36");
exit_test("Error:test36: no folder error (ERR_NOOBJ)");
}

/* ----------------------
Expand Down Expand Up @@ -120,11 +120,15 @@ DSI *dsi;
afp_filedir_unpack(&filedir, dsi->data +ofs, 0, bitmap);

if (filedir.pdid != 2) {
fprintf(stdout,"\tFAILED %x should be %x\n",filedir.pdid, 2 );
if (!Quiet) {
fprintf(stdout,"\tFAILED %x should be %x\n",filedir.pdid, 2 );
}
failed_nomsg();
}
if (strcmp(filedir.lname, name)) {
fprintf(stdout,"\tFAILED %s should be %s\n",filedir.lname, name );
if (!Quiet) {
fprintf(stdout,"\tFAILED %s should be %s\n",filedir.lname, name );
}
failed_nomsg();
}
FAIL (FPEnumerate(Conn, vol, DIRDID_ROOT , "", 0, bitmap))
Expand All @@ -136,11 +140,15 @@ DSI *dsi;
afp_filedir_unpack(&filedir, dsi->data +ofs, 0, bitmap);

if (filedir.pdid != 2) {
fprintf(stdout,"\tFAILED %x should be %x\n",filedir.pdid, 2 );
if (!Quiet) {
fprintf(stdout,"\tFAILED %x should be %x\n",filedir.pdid, 2 );
}
failed_nomsg();
}
if (strcmp(filedir.lname, name)) {
fprintf(stdout,"\tFAILED %s should be %s\n",filedir.lname, name );
if (!Quiet) {
fprintf(stdout,"\tFAILED %s should be %s\n",filedir.lname, name );
}
failed_nomsg();
}

Expand Down Expand Up @@ -174,8 +182,6 @@ int ret;
uint16_t vol = VolID;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"test95: exchange files\n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand Down Expand Up @@ -250,7 +256,7 @@ uint16_t vol = VolID;
FAIL (FPDelete(Conn, vol, DIRDID_ROOT, name))
FAIL (FPDelete(Conn, vol, DIRDID_ROOT, name1))
test_exit:
exit_test("test95");
exit_test("Error:test95: exchange files");
}

/* ----------------- */
Expand All @@ -261,8 +267,6 @@ char *name = "t99 dir no access";
uint16_t vol = VolID;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:t99: test folder without access right\n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand All @@ -278,7 +282,7 @@ uint16_t vol = VolID;
#endif
delete_folder(vol, DIRDID_ROOT, name);
test_exit:
exit_test("test99");
exit_test("Error:test99: test folder without access right");
}

/* --------------------- */
Expand All @@ -297,8 +301,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:t100: no obj cname error (AFPERR_NOOBJ)\n");

dt = FPOpenDT(Conn,vol);
FAIL (ntohl(AFPERR_NOOBJ) != FPAddComment(Conn, vol, DIRDID_ROOT , name1,"essai"))
Expand Down Expand Up @@ -357,7 +359,7 @@ int dt;
FAIL (ntohl(AFPERR_NOOBJ) != FPDelete(Conn, vol, DIRDID_ROOT , name1))

FAIL (ntohl(AFPERR_NOOBJ) != FPMoveAndRename(Conn, vol, DIRDID_ROOT, DIRDID_ROOT, name1, name))
exit_test("test100");
exit_test("Error:test100: no obj cname error (AFPERR_NOOBJ)");
}

/* --------------------- */
Expand All @@ -377,8 +379,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:t101: access error cname \n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand Down Expand Up @@ -447,7 +447,7 @@ int dt;
FAIL (ntohl(AFPERR_ACCESS) != FPMoveAndRename(Conn, vol, DIRDID_ROOT, DIRDID_ROOT, name1, name))
delete_folder(vol, DIRDID_ROOT, ndir);
test_exit:
exit_test("test101");
exit_test("Error:test101: access error cname");
}

/* --------------------- */
Expand Down Expand Up @@ -486,8 +486,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:t102: access error but not cname \n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand Down Expand Up @@ -570,7 +568,7 @@ int dt;
if (ret)
delete_folder(vol, DIRDID_ROOT, name1);
test_exit:
exit_test("test102");
exit_test("Error:test102: access error but not cname");
}

/* --------------------- */
Expand All @@ -590,8 +588,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"t103: did access error \n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand Down Expand Up @@ -676,7 +672,7 @@ int dt;
if (ret)
delete_folder(vol, DIRDID_ROOT, name1);
test_exit:
exit_test("test103");
exit_test("Error:test103: did access error");
}

/* --------------------- */
Expand All @@ -696,8 +692,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:t105: bad DID in call \n");

dir = 0;
err = ntohl(AFPERR_PARAM);
Expand Down Expand Up @@ -751,7 +745,7 @@ int dt;
FAIL (err != FPRename(Conn, vol, dir, name1, name))
FAIL (err != FPDelete(Conn, vol, dir , name1))
FAIL (err != FPMoveAndRename(Conn, vol, dir, DIRDID_ROOT, name1, name))
exit_test("test105");
exit_test("Error:test105: bad DID in call");
}

/* -------------------------- */
Expand All @@ -772,8 +766,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:test170: cname error did=1 name=\"\"\n");

/* ---- fork.c ---- */
fork = FPOpenFork(Conn, vol, OPENFORK_DATA , bitmap ,DIRDID_ROOT_PARENT, "",OPENACC_WR | OPENACC_RD);
Expand Down Expand Up @@ -891,7 +883,7 @@ int dt;
FAIL (ntohl(AFPERR_NOOBJ) != FPGetComment(Conn, vol, DIRDID_ROOT_PARENT , ""))
FAIL (ntohl(AFPERR_NOOBJ) != FPRemoveComment(Conn, vol, DIRDID_ROOT_PARENT , ""))
FAIL (FPCloseDT(Conn, dt))
exit_test("test170");
exit_test("Error:test170: cname error did=1 name=\"\"");
}

/* -------------------------- */
Expand All @@ -914,8 +906,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:test171: cname error did=1 name=bad name\n");

/* ---- fork.c ---- */
fork = FPOpenFork(Conn, vol, OPENFORK_DATA , bitmap , tdir, tname,OPENACC_WR | OPENACC_RD);
Expand Down Expand Up @@ -1021,7 +1011,7 @@ int dt;
FAIL (ntohl(AFPERR_NOOBJ) != FPGetComment(Conn, vol, tdir, tname))
FAIL (ntohl(AFPERR_NOOBJ) != FPRemoveComment(Conn, vol, tdir, tname))
FAIL (FPCloseDT(Conn, dt))
exit_test("test171");
exit_test("Error:test171: cname error did=1 name=bad name");
}

/* -------------------------- */
Expand All @@ -1044,8 +1034,6 @@ int dt;
dsi = &Conn->dsi;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:test173: did error did=0 name=test173 name\n");

/* ---- fork.c ---- */
fork = FPOpenFork(Conn, vol, OPENFORK_DATA , bitmap , tdir, tname,OPENACC_WR | OPENACC_RD);
Expand Down Expand Up @@ -1155,7 +1143,7 @@ int dt;
FAIL (FPCloseDT(Conn, dt))

/* ---- appl.c ---- */
exit_test("test173");
exit_test("Error:test173: did error did=0 name=test173 name");
}

/* -------------------------- */
Expand All @@ -1178,8 +1166,6 @@ DSI *dsi2;
int dt;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"Error:test174: did error two users from parent folder did=<deleted> name=test174 name\n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
Expand Down Expand Up @@ -1256,7 +1242,7 @@ int dt;
FAIL (FPCreateFile(Conn, vol, 0, DIRDID_ROOT , name1))

ret = FPExchangeFile(Conn, vol, tdir,dir, tname, name1);
if (ntohl(AFPERR_NOOBJ) != ret) {
if (ntohl(AFPERR_NOOBJ) != ret && !Quiet) {
if (Quirk && ret == htonl(AFPERR_PARAM))
fprintf(stdout,"\tFAILED (IGNORED) not always the same error code!\n");
else
Expand Down Expand Up @@ -1325,33 +1311,31 @@ int dt;
FAIL (ntohl(AFPERR_NOOBJ) != FPRemoveComment(Conn, vol, tdir, tname))
FAIL (FPCloseDT(Conn, dt))
test_exit:
exit_test("test174");
exit_test("Error:test174: did error two users from parent folder did=<deleted> name=test174 name");
}

/* ----------- */
void Error_test()
{
fprintf(stdout,"===================\n");
fprintf(stdout,"Various errors\n");
fprintf(stdout,"-------------------\n");
test36();
// FIXME: afpd crash in dircache_search_by_did()
#if 0
test95();
#endif
test99();
test100();
test101();
test102();
test103();
test105();
// FIXME: these tests are crashing the test suite
// FIXME: afpd crash in dircache_search_by_did()
#if 0
test95();
test170();
test171();
test173();
test174();
#else
fprintf(stdout,"test95 - SKIPPED - crashing test suite\n");
fprintf(stdout,"test170 - SKIPPED - crashing test suite\n");
fprintf(stdout,"test171 - SKIPPED - crashing test suite\n");
fprintf(stdout,"test173 - SKIPPED - crashing test suite\n");
fprintf(stdout,"test174 - SKIPPED - crashing test suite\n");
#endif
test174();
}
17 changes: 9 additions & 8 deletions test/testsuite/FPAddAPPL.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ unsigned int pdir;
int dir;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"FPAddAPPL:test214: test appl\n");

if (!Conn2) {
test_skipped(T_CONN2);
Expand Down Expand Up @@ -65,7 +63,7 @@ int dir;
FAIL (FPDelete(Conn, vol, DIRDID_ROOT , file))
FAIL (FPCloseDT(Conn,dt))
test_exit:
exit_test("test214");
exit_test("FPAddAPPL:test214: test appl");
}

/* ------------------------- */
Expand All @@ -85,8 +83,6 @@ struct afp_filedir_parms filedir;
int dir;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout,"FPAddAPPL:test301: test appl\n");
if (!Conn2) {
dir = get_did(Conn, vol, did, name);
if (!dir) {
Expand All @@ -102,12 +98,16 @@ int dir;
(1<< DIRPBIT_ATTR) | (1<< DIRPBIT_LNAME) | (1<< DIRPBIT_PDID) | (1<< DIRPBIT_DID)|(1<< DIRPBIT_ACCESS)
| (1<<DIRPBIT_UID) | (1 << DIRPBIT_GID));
if (ret) {
fprintf(stdout, "OK can't create a file\n");
if (!Quiet) {
fprintf(stdout, "OK can't create a file\n");
}
goto fin;
}
fork = FPOpenFork(Conn, vol, OPENFORK_DATA , 0 ,dir, file,OPENACC_RD| OPENACC_WR );
if (fork) {
fprintf(stdout, "Ouch now we have a fork open then read/write in a folder we no access\n");
if (!Quiet) {
fprintf(stdout, "Ouch now we have a fork open then read/write in a folder we no access\n");
}
FPCloseFork(Conn,fork);
}
}
Expand Down Expand Up @@ -142,14 +142,15 @@ int dir;
FPCloseVol(Conn2,vol2);
}
fin:
exit_test("test301");
exit_test("FPAddAPPL:test301: test appl");
}

/* ----------- */
void FPAddAPPL_test()
{
fprintf(stdout,"===================\n");
fprintf(stdout,"FPAddAPPL page 94\n");
fprintf(stdout,"-------------------\n");
test214();
/*
test301();
Expand Down
8 changes: 4 additions & 4 deletions test/testsuite/FPAddComment.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ char *cmt;
int dt;

enter_test();
fprintf(stdout,"===================\n");
fprintf(stdout, "FPAddComment:test55: add comment\n");
if (!Conn2) {
test_skipped(T_CONN2);
goto test_exit;
}

if (!(rdir = read_only_folder(vol, DIRDID_ROOT, name2) ) ) {
nottested();
goto test_exit;
}
if (!(pdir = no_access_folder(vol, DIRDID_ROOT, name))) {
if (!(pdir = no_access_folder(vol, DIRDID_ROOT, name)) && !Quiet) {
fprintf(stdout,"\tWARNING folder without access failed\n");
}
dsi2 = &Conn2->dsi;
Expand Down Expand Up @@ -101,13 +100,14 @@ int dt;
}
FAIL (FPCloseDT(Conn, dt))
test_exit:
exit_test("test55");
exit_test("FPAddComment:test55: add comment");
}

/* ----------- */
void FPAddComment_test()
{
fprintf(stdout,"===================\n");
fprintf(stdout,"FPAddComment page 96\n");
fprintf(stdout,"-------------------\n");
test55();
}
Loading

0 comments on commit a757160

Please sign in to comment.