int ndmca_tt_openclose (struct ndm_session *sess) { int rc; ndmca_test_phase (sess, "T-OC", "Tape Open/Close"); rc = ndmca_test_tape_close (sess, NDMP9_DEV_NOT_OPEN_ERR); if (rc) return rc; rc = ndmca_test_tape_open (sess, NDMP9_NO_DEVICE_ERR, "bogus", NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_open (sess, NDMP9_ILLEGAL_ARGS_ERR, 0, 123); if (rc) return rc; rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; rc = ndmca_test_tape_open (sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_open (sess, NDMP9_DEVICE_OPENED_ERR, 0, NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; /* pass */ }
int ndmca_td_listen (struct ndm_session *sess) { struct ndm_control_agent *ca = sess->control_acb; int rc; ndmca_test_phase (sess, "D-LISTEN", "Data LISTEN State Series"); rc = ndmca_test_check_data_state (sess, NDMP9_DATA_STATE_IDLE, 0); if (rc) return rc; if (ca->has_tcp_addr) { rc = ndmca_td_listen_subr (sess, NDMP9_NO_ERR, NDMP9_ADDR_TCP); if (rc) return rc; } if (ca->has_local_addr) { rc = ndmca_td_listen_subr (sess, NDMP9_NO_ERR, NDMP9_ADDR_LOCAL); if (rc) return rc; } ndmca_test_done_phase (sess); /* * Bogus arguments */ ndmca_test_phase (sess, "D-LISTEN/bogus-args", "Data LISTEN State Series w/ bogus args"); rc = ndmca_test_data_listen (sess, NDMP9_ILLEGAL_ARGS_ERR, 123); if (rc) return rc; ndmca_test_done_phase (sess); return 0; /* pass */ }
int ndmca_td_idle (struct ndm_session *sess) { int rc; ndmca_test_phase (sess, "D-IDLE", "Data IDLE State Series"); rc = ndmca_test_check_data_state (sess, NDMP9_DATA_STATE_IDLE, 0); if (rc) return rc; rc = ndmca_test_data_abort (sess, NDMP9_ILLEGAL_STATE_ERR); if (rc) return rc; rc = ndmca_test_data_stop (sess, NDMP9_ILLEGAL_STATE_ERR); if (rc) return rc; return 0; /* pass */ }
int ndmca_tt_basic_getstate (struct ndm_session *sess) { int rc; ndmca_test_phase (sess, "T-BGS", "Tape Get State Basics"); rc = ndmca_test_tape_get_state (sess, NDMP9_DEV_NOT_OPEN_ERR); if (rc) return rc; rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_get_state (sess, NDMP9_NO_ERR); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; /* pass */ }
/* * Assumes tt_write() passed */ int ndmca_tt_mtio (struct ndm_session *sess) { int rc; unsigned n_rec; unsigned recsize; unsigned fileno, recno; u_long count, resid; char * what; char note[128]; char pbuf[64*1024]; char buf[64*1024]; ndmca_test_phase (sess, "T-MTIO", "Tape MTIO"); rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; for (fileno = 0; tt_series[fileno].n_rec > 0; fileno++) { n_rec = tt_series[fileno].n_rec; recsize = tt_series[fileno].recsize; sprintf (note, "Seek around tape file %d", fileno+1); ndmca_test_open (sess, note, 0); sprintf (note, "file #%d, %d records, %d bytes/rec", fileno+1, n_rec, recsize); ndmca_test_log_note (sess, 2, note); what = "rew"; count = 1; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_REW, count, &resid); if (rc) goto fail; what = "rew resid"; if (resid != 0) goto fail; CHECK_FILENO_RECNO ("rew", 0, 0); what = "fsf(n)"; count = fileno; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSF, count, &resid); if (rc) goto fail; what = "fsf(n) resid"; if (resid != 0) goto fail; CHECK_FILENO_RECNO ("fsf", fileno, 0); what = "fsr(1m)"; count = 1000000; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSR, count, &resid); if (rc) goto fail; what = "fsr(1m) resid"; if (n_rec + resid != count) goto fail; if (sess->plumb.tape->protocol_version < 4) { CHECK_FILENO_RECNO ("fsr(1m)", fileno + 1, 0); what = "bsf 1 after fsr(1m)"; count = 1; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_BSF, count, 0); if (rc) goto fail; CHECK_FILENO_RECNO (what, fileno, -1); recno = n_rec; } else { /* EOT side of EOF marker */ recno = n_rec; CHECK_FILENO_RECNO ("fsr(1m)", fileno, recno); } what = "bsr(1m)"; count = 1000000; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_BSR, count, &resid); if (rc) goto fail; what = "bsr(1m) resid"; if (n_rec + resid != count) goto fail; if ((fileno > 0) && (sess->plumb.tape->protocol_version < 4)) { /* at BOT side of EOF marker (not BOT) */ CHECK_FILENO_RECNO ("bsr(1m)", fileno - 1, -1); what = "fsf 1 after bsr(1m)"; count = 1; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSF, count, 0); if (rc) goto fail; } recno = 0; CHECK_FILENO_RECNO ("bsr(1m)", fileno, recno); what = "fsr(0)"; count = 0; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSR, count, &resid); if (rc) goto fail; what = "fsr(0) resid"; if (resid != 0) goto fail; recno = 0; CHECK_FILENO_RECNO ("fsr(0)", fileno, recno); what = "fsr(x)"; count = n_rec / 2; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSR, count, &resid); if (rc) goto fail; what = "fsr(x) resid"; if (resid != 0) goto fail; recno = n_rec / 2; CHECK_FILENO_RECNO ("fsr(x)", fileno, recno); what = "fsr(x) read"; rc = ndmca_tape_read (sess, buf, recsize); if (rc) goto fail; what = "fsr(x) compare"; ndmca_test_fill_data (pbuf, recsize, recno, fileno); if (bcmp (buf, pbuf, recsize) != 0) goto fail; recno++; /* caused by tape_read */ if (recno > 1) { what = "bsr(2)"; count = 2; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_BSR, count, &resid); if (rc) goto fail; what = "bsr(2) resid"; if (resid != 0) goto fail; recno -= count; CHECK_FILENO_RECNO ("bsr(2)", fileno, recno); what = "bsr(2) read"; rc = ndmca_tape_read (sess, buf, recsize); if (rc) goto fail; what = "bsr(2) compare"; ndmca_test_fill_data (pbuf, recsize, recno, fileno); if (bcmp (buf, pbuf, recsize) != 0) goto fail; } sprintf (buf, "Passed %s", note); ndmca_test_log_step (sess, 2, buf); } rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; fail: sprintf (buf, "Failed %s: %s", what, note); ndmca_test_fail (sess, buf); return -1; }
/* * Assumes tt_write() passed */ int ndmca_tt_read (struct ndm_session *sess) { int rc; unsigned n_rec; unsigned recsize; unsigned fileno, recno; char * what; char note[128]; char pbuf[64*1024]; char buf[64*1024]; ndmca_test_phase (sess, "T-READ", "Tape Read Series"); rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; for (fileno = 0; tt_series[fileno].n_rec > 0; fileno++) { n_rec = tt_series[fileno].n_rec; recsize = tt_series[fileno].recsize; sprintf (note, "Read tape file %d", fileno+1); ndmca_test_open (sess, note, 0); sprintf (note, "file #%d, %d records, %d bytes/rec", fileno+1, n_rec, recsize); ndmca_test_log_note (sess, 2, note); for (recno = 0; recno < n_rec; recno++) { ndmca_test_fill_data (pbuf, recsize, recno, fileno); what = "read"; rc = ndmca_tape_read (sess, buf, recsize); if (rc) goto fail; CHECK_FILENO_RECNO ("read", fileno, recno+1); what = "compare"; #if 0 if (bcmp (buf, pbuf, recsize) != 0) goto fail; #else if (bcmp (buf, pbuf, recsize) != 0) { unsigned char *expect_p = (unsigned char *)pbuf; unsigned char *got_p = (unsigned char *)buf; unsigned int i, f; for(f = i = 0; f < 64 && i < recsize; i++, expect_p++, got_p++) { if (*expect_p != *got_p) { char tmp[80]; sprintf (tmp, "%d: 0x%x => 0x%x", i, *expect_p, *got_p); ndmalogf (sess, "DATA", 6, tmp); f++; } } goto fail; } #endif } what = "eof read"; rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, recsize); if (rc) goto fail; if (sess->plumb.tape->protocol_version > 3) { CHECK_FILENO_RECNO ("eof", fileno, -1); what = "skip filemark"; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSF, 1, 0); if (rc) goto fail; CHECK_FILENO_RECNO ("skip", fileno+1, 0); } else { CHECK_FILENO_RECNO ("eof", fileno+1, 0); } sprintf (buf, "Passed tape read %s", note); ndmca_test_log_step (sess, 2, buf); } rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; fail: sprintf (buf, "Failed %s recno=%d; %s", what, recno, note); ndmca_test_fail (sess, buf); return -1; }
/* * Precedes tt_read() so that we can make a "known" tape. */ int ndmca_tt_write (struct ndm_session *sess) { int rc; unsigned n_rec; unsigned recsize; unsigned fileno, recno; char * what; char note[128]; char buf[64*1024]; ndmca_test_phase (sess, "T-WRITE", "Tape Write Series"); rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; for (fileno = 0; tt_series[fileno].n_rec > 0; fileno++) { n_rec = tt_series[fileno].n_rec; recsize = tt_series[fileno].recsize; sprintf (note, "Write tape file %d", fileno+1); ndmca_test_open (sess, note, 0); sprintf (note, "file #%d, %d records, %d bytes/rec", fileno+1, n_rec, recsize); ndmca_test_log_note (sess, 2, note); for (recno = 0; recno < n_rec; recno++) { ndmca_test_fill_data (buf, recsize, recno, fileno); what = "write"; rc = ndmca_tape_write (sess, buf, recsize); if (rc) goto fail; CHECK_FILENO_RECNO ("write", fileno, recno+1); } what = "write filemark"; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_EOF, 1, 0); if (rc) goto fail; CHECK_FILENO_RECNO ("wfm", fileno+1, 0); /* no test calls so the file operation is the test */ sprintf (buf, "Passed tape write %s", note); ndmca_test_log_step (sess, 2, buf); } rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; fail: sprintf (buf, "Failed %s recno=%d; %s", what, recno, note); ndmca_test_fail (sess, buf); return -1; }
/* * Assumes tt_basic_read() and tt_basic_write() have been done verifying * READ and WRITE operations work... */ int ndmca_tt_basic_write_and_read (struct ndm_session *sess) { int rc, i, f, pass; char buf[64*1024]; char *p; ndmca_test_phase (sess, "T-BWR", "Tape Write and Read Basics"); /* * check EOF and EOM by rewinding and putting on 1 EOF mark */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_BSR, 100, 100); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_BSF, 100, 100); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_EOF, 1, 0); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_BSF, 100, 99); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_FSF, 100, 99); if (rc) return rc; /* we are at EOM */ if (sess->plumb.tape->protocol_version < 4) { rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, sizeof(buf)); if (rc) return rc; /* check it again */ rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, 1024); if (rc) return rc; } else { rc = ndmca_test_tape_read (sess, NDMP9_EOM_ERR, buf, sizeof(buf)); if (rc) return rc; /* check it again */ rc = ndmca_test_tape_read (sess, NDMP9_EOM_ERR, buf, 1024); if (rc) return rc; } /* rewind and place 1 record in tape -- no EOF marker by seeking */ rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_write (sess, NDMP9_NO_ERR, buf, 512); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_BSR, 100, 99); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_FSR, 100, 99); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_FSR, 100, 100); if (rc) return rc; rc = ndmca_check_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_FSF, 100, 100); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * perform tape label type processing with positioning ops */ for(pass = 0; pass < 2; pass++) { /* * open the tape and write 1 record and close it */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; for(p = buf, i = 0; i < 1024; i++, p++) *p = ((i - 4) & 0xff); rc = ndmca_test_tape_write (sess, NDMP9_NO_ERR, buf, 1024); if (rc) return rc; rc = ndmca_tape_mtio (sess, NDMP9_MTIO_EOF, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * open the tape and read it */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; if (pass == 1) rc = ndmca_test_tape_read_2cnt (sess, NDMP9_NO_ERR, buf, sizeof(buf), 1024); else rc = ndmca_test_tape_read (sess, NDMP9_NO_ERR, buf, 1024); if (rc) return rc; for(p = buf, f = i = 0; f < 64 && i < 1024; i++, p++) if (*p != ((i - 4) & 0xff)) { char tmp[80]; sprintf (tmp, "%d: 0x%x => 0x%x", i, ((i - 4) & 0xff), *p); ndmalogf (sess, "DATA", 6, tmp); f++; } if (f > 0) { ndmca_test_fail (sess, "Failed compare"); return -1; } rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, 1024); if (rc) return rc; /* check EOM */ if (sess->plumb.tape->protocol_version < 4) { rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, 1024); if (rc) return rc; } else { /* skip over filemark */ rc = ndmca_tape_mtio (sess, NDMP9_MTIO_FSF, 1, 0); /* read EOM */ rc = ndmca_test_tape_read (sess, NDMP9_EOM_ERR, buf, 1024); if (rc) return rc; } rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; } return 0; /* pass */ }
int ndmca_tt_basic_read (struct ndm_session *sess) { int rc, ix; char buf[2048]; ndmp9_error expect_errs[5]; ndmca_test_phase (sess, "T-BR", "Tape Read Basics"); rc = ndmca_test_tape_read (sess, NDMP9_DEV_NOT_OPEN_ERR, buf, 1024); if (rc) return rc; /* * Read w/ bogus lengths -- mode=READ_MODE */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; /* read/len=0 MUST be NDMP[23]_NO_ERR or NDMP[23]_ILLEGAL_ARGS */ /* read/len=0 MUST be NDMP4_NO_ERR */ ix = 0; if (sess->plumb.tape->protocol_version < 4) { expect_errs[ix++] = NDMP9_ILLEGAL_ARGS_ERR; } expect_errs[ix++] = NDMP9_NO_ERR; expect_errs[ix++] = -1; rc = ndmca_tape_read (sess, buf, 0); rc = ndmca_test_check_expect_errs (sess->plumb.tape, rc, expect_errs); if (rc) return rc; rc = ndmca_test_tape_read(sess,NDMP9_ILLEGAL_ARGS_ERR,buf,0x80000000); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * Read works -- mode=WRITE_MODE (just to mix it up) */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_read (sess, NDMP9_NO_ERR, buf, 1024); if (rc) return rc; rc = ndmca_test_tape_read (sess, NDMP9_EOF_ERR, buf, 1024); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * Read works w/ oversize -- mode=READ_MODE (just to mix it up) */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_read_2cnt (sess, NDMP9_NO_ERR, buf, 2048, 1024); if (rc) return rc; rc = ndmca_test_tape_read_2cnt (sess, NDMP9_EOF_ERR, buf, 2048, 1024); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * Read works w/ undersize -- mode=READ_MODE (just to mix it up) */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_read_2cnt (sess, NDMP9_NO_ERR, buf, 512, 512); if (rc) return rc; rc = ndmca_test_tape_read_2cnt (sess, NDMP9_EOF_ERR, buf, 512, 512); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; /* pass */ }
/* * Precedes tt_basic_read() so that we can make a "known" tape. */ int ndmca_tt_basic_write (struct ndm_session *sess) { int rc, ix; char buf[1024]; ndmp9_error expect_errs[5]; ndmca_test_phase (sess, "T-BW", "Tape Write Basics"); rc = ndmca_test_tape_write (sess, NDMP9_DEV_NOT_OPEN_ERR, buf, 1024); if (rc) return rc; /* * Write w/ read-only open mode */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_READ_MODE); if (rc) return rc; rc = ndmca_test_tape_write (sess, NDMP9_PERMISSION_ERR, buf, 1024); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * Write w/ bogus lengths */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; /* OPEN Question: what does len==0 mean? */ /* write/len=0 MUST be NDMP[234]_NO_ERR or NDMP[234]_ILLEGAL_ARGS */ /* write/len=0 MUST be NDMP4_NO_ERR */ ix = 0; if (sess->plumb.tape->protocol_version < 5) { expect_errs[ix++] = NDMP9_ILLEGAL_ARGS_ERR; } expect_errs[ix++] = NDMP9_NO_ERR; expect_errs[ix++] = -1; rc = ndmca_tape_write (sess, buf, 0); rc = ndmca_test_check_expect_errs (sess->plumb.tape, rc, expect_errs); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; /* * TODO: bogus length */ /* * Write works */ rc = ndmca_test_tape_open(sess,NDMP9_NO_ERR,0,NDMP9_TAPE_RDWR_MODE); if (rc) return rc; rc = ndmca_test_tape_write (sess, NDMP9_NO_ERR, buf, 1024); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_EOF, 1, 0); if (rc) return rc; rc = ndmca_test_tape_mtio (sess, NDMP9_NO_ERR, NDMP9_MTIO_REW, 1, 0); if (rc) return rc; rc = ndmca_test_tape_close (sess, NDMP9_NO_ERR); if (rc) return rc; return 0; /* pass */ }