4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 func Test210OptAbort(t
*testing
.T
) {
26 t
.Fatalf("could not create handle: %s", err
)
30 err
= h
.SetOptMode(true)
32 t
.Fatalf("could not set opt mode: %s", err
)
35 err
= h
.ConnectCommand([]string{
36 "nbdkit", "-s", "--exit-with-parent", "-v", "null",
39 t
.Fatalf("could not connect: %s", err
)
42 proto
, err
:= h
.GetProtocol()
44 t
.Fatalf("could not get correct protocol: %s", err
)
45 } else if *proto
!= "newstyle-fixed" {
46 t
.Fatalf("wrong protocol detected: %s", *proto
)
49 sr
, err
:= h
.GetStructuredRepliesNegotiated()
51 t
.Fatalf("could not determine structured replies: %s", err
)
53 t
.Fatalf("structured replies not negotiated")
58 t
.Fatalf("could not abort option mode: %s", err
)
61 closed, err
:= h
.AioIsClosed()
63 t
.Fatalf("could not determine state after opt_abort: %s", err
)
65 t
.Fatalf("wrong state after opt_abort")
70 t
.Fatalf("getting a size should not be possible")