Message ID | 20201201203829.1735559-2-lkundrak@v3.sk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tests/etnaviv_2d_test: some test improvements | expand |
Am Di., 1. Dez. 2020 um 21:38 Uhr schrieb Lubomir Rintel <lkundrak@v3.sk>: > > Just so that it's obvious what failed and why. > > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> > --- > tests/etnaviv/etnaviv_2d_test.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c > index 8dd77b66..eb9dfa59 100644 > --- a/tests/etnaviv/etnaviv_2d_test.c > +++ b/tests/etnaviv/etnaviv_2d_test.c > @@ -162,9 +162,16 @@ int main(int argc, char *argv[]) > drmVersionPtr version; > int fd, ret = 0; > > - fd = open(argv[1], O_RDWR); > - if (fd < 0) > + if (argc < 2) { > + fprintf(stderr, "Usage: %s /dev/dri/<device>\n", argv[0]); > return 1; > + } > + > + fd = open(argv[1], O_RDWR); > + if (fd < 0) { > + perror(argv[1]); > + return 1; > + } > > version = drmGetVersion(fd); > if (version) { > @@ -178,6 +185,7 @@ int main(int argc, char *argv[]) > > dev = etna_device_new(fd); > if (!dev) { > + perror("etna_device_new"); > ret = 2; > goto out; > } > @@ -185,18 +193,21 @@ int main(int argc, char *argv[]) > /* TODO: we assume that core 0 is a 2D capable one */ > gpu = etna_gpu_new(dev, 0); > if (!gpu) { > + perror("etna_gpu_new"); > ret = 3; > goto out_device; > } > > pipe = etna_pipe_new(gpu, ETNA_PIPE_2D); > if (!pipe) { > + perror("etna_pipe_new"); > ret = 4; > goto out_gpu; > } > > bmp = etna_bo_new(dev, bmp_size, ETNA_BO_UNCACHED); > if (!bmp) { > + perror("etna_bo_new"); > ret = 5; > goto out_pipe; > } > @@ -204,6 +215,7 @@ int main(int argc, char *argv[]) > > stream = etna_cmd_stream_new(pipe, 0x300, NULL, NULL); > if (!stream) { > + perror("etna_cmd_stream_new"); > ret = 6; > goto out_bo; > } > -- > 2.28.0 > > _______________________________________________ > etnaviv mailing list > etnaviv@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/etnaviv
diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c index 8dd77b66..eb9dfa59 100644 --- a/tests/etnaviv/etnaviv_2d_test.c +++ b/tests/etnaviv/etnaviv_2d_test.c @@ -162,9 +162,16 @@ int main(int argc, char *argv[]) drmVersionPtr version; int fd, ret = 0; - fd = open(argv[1], O_RDWR); - if (fd < 0) + if (argc < 2) { + fprintf(stderr, "Usage: %s /dev/dri/<device>\n", argv[0]); return 1; + } + + fd = open(argv[1], O_RDWR); + if (fd < 0) { + perror(argv[1]); + return 1; + } version = drmGetVersion(fd); if (version) { @@ -178,6 +185,7 @@ int main(int argc, char *argv[]) dev = etna_device_new(fd); if (!dev) { + perror("etna_device_new"); ret = 2; goto out; } @@ -185,18 +193,21 @@ int main(int argc, char *argv[]) /* TODO: we assume that core 0 is a 2D capable one */ gpu = etna_gpu_new(dev, 0); if (!gpu) { + perror("etna_gpu_new"); ret = 3; goto out_device; } pipe = etna_pipe_new(gpu, ETNA_PIPE_2D); if (!pipe) { + perror("etna_pipe_new"); ret = 4; goto out_gpu; } bmp = etna_bo_new(dev, bmp_size, ETNA_BO_UNCACHED); if (!bmp) { + perror("etna_bo_new"); ret = 5; goto out_pipe; } @@ -204,6 +215,7 @@ int main(int argc, char *argv[]) stream = etna_cmd_stream_new(pipe, 0x300, NULL, NULL); if (!stream) { + perror("etna_cmd_stream_new"); ret = 6; goto out_bo; }
Just so that it's obvious what failed and why. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- tests/etnaviv/etnaviv_2d_test.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)