X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fc9f51bcc74a57919fd0479dfe585f5e2bdc3310..84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6:/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c diff --git a/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c b/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c index 1404684301..fe36b7c23e 100644 --- a/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c +++ b/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014. The SimGrid Team. +/* Copyright (c) 2011-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,11 +11,46 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(dsend,"the dsend test"); -int main(int argc, char *argv[]) { +static void test_opts(int argc, char* const argv[]) +{ + int found = 0; + int option_index = 0; + static struct option long_options[] = { + {(char*)"long", no_argument, 0, 0 }, + {0, 0, 0, 0 } + }; + while (1) { + int ret = getopt_long(argc, argv, "s", long_options, &option_index); + if(ret==-1) + break; + + switch (ret) { + case 0: + found++; + break; + case 's': + found ++; + break; + default: + printf("option %s", long_options[option_index].name); + break; + } + } + if (found!=2){ + printf("(smpi_)getopt_long failed ! \n"); + } +} + +int main(int argc, char *argv[]) +{ int rank; int32_t data=11; - MPI_Init(&argc, &argv); + MPI_Init(NULL, NULL); + + /* test getopt_long function */ + test_opts(argc, argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Request r; if (rank==1) { @@ -40,7 +75,6 @@ int main(int argc, char *argv[]) { } } - XBT_INFO("rank %d: data exchanged", rank); MPI_Finalize(); return 0;