diff --git a/ggatessh/ggatessh.c b/ggatessh/ggatessh.c index 66bc364..9e2cb76 100644 --- a/ggatessh/ggatessh.c +++ b/ggatessh/ggatessh.c @@ -130,6 +130,21 @@ usage(void) exit(EXIT_FAILURE); } +#if 0 +static void +libssh2_debug_error(LIBSSH2_SESSION *session, const char *info) +{ + char *errmsg; + int error; + int rc; + + error = libssh2_session_last_errno(session); + rc = libssh2_session_last_error(session, &errmsg, NULL, 0); + + g_gate_log(LOG_DEBUG, "%s: %s(%d)", info, errmsg, error); +} +#endif + static void libssh2_errorx(LIBSSH2_SESSION *session, const char *info) { @@ -825,8 +840,16 @@ procreq: if (gsc_pending->sc_session != NULL) { *didworkp = 1; gsc_pending->sc_handle = libssh2_sftp_open( - gsc_pending->sc_session, "fstest/data.img", + gsc_pending->sc_session, imgpath, get_open_flags(), 0); + + if (gsc_pending->sc_handle == NULL) { + error = libssh2_session_last_errno( + session); + if (error != LIBSSH2_ERROR_EAGAIN) + libssh2_errorx(session, + "sftp_open"); + } } g_gate_log(LOG_DEBUG, diff --git a/tests/ggatessh_test.sh b/tests/ggatessh_test.sh index fb08324..b858ad6 100644 --- a/tests/ggatessh_test.sh +++ b/tests/ggatessh_test.sh @@ -43,7 +43,7 @@ ggatessh_body() wait_for_ggate_device ${ggate_dev} - # make sure it has correct size and sector sizekj + # make sure it has correct size and sector size read _dev _secsize _size _nsecs _stripesize _stripeoff < ggatessh.log & + ggatepid="$!" + + # This test will timeout if ggatessh exits before dd does, dump + # the log to find out why + + # wait for IO to complete + wait "$dd1pid" + echo "dd exit:" $? + + wait "$dd2pid" + echo "dd exit:" $? + + # kill off ggate + kill "$ggatepid" + wait "$ggatepid" + + #echo 'log:' + #cat ggatessh.log + #echo 'end of log' + + # make sure the second session was successfully created + cnt=$(grep "new session created" ggatessh.log | wc -l) + if [ "$cnt" -ne 1 ]; then + echo "not the correct number of new sessions: $cnt" + return 1 + fi +} + +ggatessh_multises_cleanup() +{ + + common_cleanup +} + atf_test_case ggatessh_rowotest cleanup ggatessh_rowotest_head() { @@ -192,7 +271,7 @@ ggatessh_rowotest_body() wait_for_ggate_device ${ggate_dev} - # make sure it has correct size and sector sizekj + # make sure it has correct size and sector size read _dev _secsize _size _nsecs _stripesize _stripeoff <