* @brief StressTest for alloc memory and inference for TRIV2 device
* @bug No known bugs except for NYI items
*/
+#include <bits/stdc++.h>
#include "stress_test.h"
while ((c = getopt (argc, argv, "i:s:a:rm:f:pthc:")) != -1) {
switch (c) {
case 'i':
- setIterNum (optarg);
+ try {
+ setIterNum (optarg);
+ } catch (...) {
+ goto err_getopt;
+ }
break;
case 's':
- setBufferSize (optarg);
+ try {
+ setBufferSize (optarg);
+ } catch (...) {
+ goto err_getopt;
+ }
break;
case 'a':
- setAllocNum (optarg);
+ try {
+ setAllocNum (optarg);
+ } catch (...) {
+ goto err_getopt;
+ }
break;
case 'r':
setAllocRandom (true);
setModelPath (optarg);
break;
case 'f':
- setInferNum (optarg);
+ try {
+ setInferNum (optarg);
+ } catch (...) {
+ goto err_getopt;
+ }
break;
case 'p':
setPauseOnIter (true);
}
}
return 0;
+
+err_getopt:
+ std::cerr << "Invalid argument for option '" << static_cast<char> (c) << "' \n";
+ printUsage (argv[0]);
+ return -1;
}
int
return status;
}
- status = stressTester.run ();
+ try {
+ status = stressTester.run ();
+ } catch (const std::bad_function_call& e) {
+ std::cerr << "Exception occurred: " << e.what () << std::endl;
+ status = -1;
+ }
+
if (status < 0) {
std::cerr << "Failed to run" << std::endl;
return status;