Skip to content

Commit

Permalink
current wokring code, need to add stuff to base test case
Browse files Browse the repository at this point in the history
  • Loading branch information
SonikaG committed Oct 13, 2017
1 parent d1118fe commit b101251
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions code/harness/c_harness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ using fs_testing::utils::communication::kSocketNameOutbound;
using fs_testing::utils::communication::ServerSocket;
using fs_testing::utils::communication::SocketError;
using fs_testing::utils::communication::SocketMessage;

static const option long_options[] = {
{"background", no_argument, NULL, 'b'},
{"test-dev", required_argument, NULL, 'd'},
Expand Down Expand Up @@ -139,22 +138,22 @@ int main(int argc, char** argv) {
****************************************************************************/
const unsigned int test_case_idx = optind;
const string path = argv[test_case_idx];
int errno = setenv("MOUNT_FS", test_dev.c_str(), 1);
if (errno < 0){
cerr << "Error Setting environment variable MOUNT_FS" << errno << endl;
if(!(setenv("MOUNT_FS", test_dev.c_str(), 1))){
cerr << "Error setting environment variable MOUNT_FS" << endl;
}
FILE *input;
char buf[512];
if(!(input = popen(("df --output=source,size | grep " + flags_dev + ">filesize.txt").c_str()){
if(!(input = popen(("df --output=source,size | grep " + flags_dev).c_str(), "r"))){
cerr << "Error finding the filesize of mounted filesystem" << endl;
}
string filesize;
while(fgets(buf, 512, input){
while(fgets(buf, 512, input)){
filesize += buf;
}
int errno = setenv("FILESYS_SIZE", filesize.c_str(), 1);
if (errno < 0){
cerr << "Error setting environment variable FILESYS_SIZE" << errno << endl;
//fileSysSize = filesize;
pclose(input);
if(!setenv("FILESYS_SIZE", filesize.c_str(), 1)){
cerr << "Error setting environment variable FILESYS_SIZE" << endl;
}
cout << "========== PHASE 0: Setting up CrashMonkey basics =========="
<< endl;
Expand Down
5 changes: 3 additions & 2 deletions code/tests/BaseTestCase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
#define TEST_CASE_H

#include "../results/DataTestResult.h"

#include <string>
namespace fs_testing {
namespace tests {

class BaseTestCase {
public:
std::string mountDir;
std::string fileSysSize;
virtual ~BaseTestCase() {};
virtual int setup() = 0;
virtual int run() = 0;
Expand All @@ -17,7 +19,6 @@ class BaseTestCase {

typedef BaseTestCase *test_create_t();
typedef void test_destroy_t(BaseTestCase *instance);

} // namespace tests
} // namespace fs_testing

Expand Down

0 comments on commit b101251

Please sign in to comment.