1 // Copyright 2006 Google Inc. All Rights Reserved. 2 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // sat.cc : a stress test for stressful testing 16 17 #include "sattypes.h" 18 #include "sat.h" 19 20 int main(int argc, char **argv) { 21 Sat *sat = SatFactory(); 22 if (sat == NULL) { 23 logprintf(0, "Process Error: failed to allocate Sat object\n"); 24 return 255; 25 } 26 27 if (!sat->ParseArgs(argc, argv)) { 28 logprintf(0, "Process Error: Sat::ParseArgs() failed\n"); 29 sat->bad_status(); 30 } else if (!sat->Initialize()) { 31 logprintf(0, "Process Error: Sat::Initialize() failed\n"); 32 sat->bad_status(); 33 } else if (!sat->Run()) { 34 logprintf(0, "Process Error: Sat::Run() failed\n"); 35 sat->bad_status(); 36 } 37 sat->PrintResults(); 38 if (!sat->Cleanup()) { 39 logprintf(0, "Process Error: Sat::Cleanup() failed\n"); 40 sat->bad_status(); 41 } 42 43 int retval; 44 if (sat->status() != 0) { 45 logprintf(0, "Process Error: Fatal issue encountered. See above logs for " 46 "details.\n"); 47 retval = 1; 48 } else if (sat->errors() != 0) { 49 retval = 1; 50 } else { 51 retval = 0; 52 } 53 54 delete sat; 55 return retval; 56 } 57