TEST_F(ParserFactoryTests, factoryTypeNameCommentOpenFilterFieldWithMethod)
{
    ASSERT_FALSE( parseDocument(
        "structure sname { integer i; }\n"
        "object factory<sname> name { filter i with blah") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 2, 48, compil::Message::p_expectSemicolon));
    EXPECT_TRUE(checkErrorMessage(1, 2, 48, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserFactoryTests, factoryTypeNameCommentOpenFilterFieldBlah)
{
    ASSERT_FALSE( parseDocument(
        "structure sname { integer i; }\n"
        "object factory<sname> name { filter i blah") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 2, 39, compil::Message::p_expectKeyword,
                    compil::Message::Keyword("with")));
    EXPECT_TRUE(checkErrorMessage(1, 2, 43, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserFactoryTests, factoryTypeNameCommentOpenFilterWithUnknownField)
{
    ASSERT_FALSE( parseDocument(
        "structure sname { integer i; }\n"
        "object factory<sname> name { filter unknown") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 2, 37, compil::Message::p_expectStatementName,
                    compil::Message::Statement("field")));
    EXPECT_TRUE(checkErrorMessage(1, 2, 44, compil::Message::p_unexpectEOFInStatementBody));
}
Example #4
0
/**
 * the message {} is considered as a valid json object and means that the 
 * parameters are right and no error occurred
 */
bool JsonMSUMessage::parseFieldsToCheckValidity(const char* message, std::string* customErrorMsg)
{
    cJSON *root = NULL;
   
    
    if ((message == NULL) || (strlen(message) == 0)) {
        LOG.error("%s: invalid JSON message", __FUNCTION__);
        
        return false;
    }
    
    if ((root = cJSON_Parse(message)) == NULL) {
        LOG.error("%s: error parsing JSON message", __FUNCTION__);
        
        return false;
    }
    
    std::vector<std::string> params;
    if (checkErrorMessage(root, errorCode, errorMessage)) {
        cJSON* error =  cJSON_GetObjectItem(root, "error");
        std::vector<std::string> params = getParameters(error);
        if (customErrorMsg != NULL && params.size() > 0) {
            // The first parameter is the error message
            *customErrorMsg = params[0];
        }
        cJSON_Delete(root);
        LOG.error("%s: error parsing JSON message", __FUNCTION__);
        return false;
    }
    cJSON_Delete(root);
    return true;
}
TEST_F(ParserIdentifierTests, identifier)
{
    ASSERT_FALSE( parseDocument(
        "identifier") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 11, compil::Message::p_expectStatementName));
}
TEST_F(ParserFactoryTests, hierarchyFactoryTypeNameCommentOpenFilter)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory<integer> name { filter") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 35, compil::Message::p_filterInNonObjectFactory));
}
TEST_F(ParserFactoryTests, factoryName)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory name") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 19, compil::Message::p_expectType));
}
TEST_F(ParserFactoryTests, factoryTypeNameCommentOpenFilterWithNoStructureType)
{
    ASSERT_FALSE( parseDocument(
        "object factory<integer> name { filter") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 32, compil::Message::p_filterInFactoryForNonStructure));
}
TEST_F(ParserFactoryTests, factoryTypeNameOpen)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory<integer> name {") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 34, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserIdentifierTests, identifierNameOpen)
{
    ASSERT_FALSE( parseDocument(
        "identifier name {") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 18, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserFactoryTests, factoryCommentBaseTypeOpen)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory /* */ <") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 19, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 26, compil::Message::p_expectType));
}
TEST_F(ParserIdentifierTests, identifierCommentBaseTypeOpen)
{
    ASSERT_FALSE( parseDocument(
        "identifier /* */ <") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 12, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 19, compil::Message::p_expectType));
}
TEST_F(ParserIdentifierTests, identifierNameCommentOpen)
{
    ASSERT_FALSE( parseDocument(
        "identifier name /* */ {") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 17, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 24, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserIdentifierTests, identifierNameWrongBaseOpenClose)
{
    ASSERT_FALSE( parseDocument(
        "identifier<real32> name {}") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 1, compil::Message::v_unacceptableParameterType,
                compil::Message::Options("small, short, integer, long, byte, word, dword or qword")));
}
TEST_F(ParserIdentifierTests, identifierNameMissingBaseOpenClose)
{
    ASSERT_FALSE( parseDocument(
        "identifier<blah> name {}") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 12, compil::Message::p_unknownClassifierType,
                  compil::Message::Type("blah")));
}
TEST_F(ParserIdentifierTests, identifierCommentBaseTypeOpenType)
{
    ASSERT_FALSE( parseDocument(
        "identifier < /* */ integer") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 14, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 27, compil::Message::p_expectClosingAngleBracket));
}
TEST_F(ParserFactoryTests, factoryCommentBaseTypeOpenType)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory < /* */ integer") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 21, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 34, compil::Message::p_expectClosingAngleBracket));
}
TEST_F(ParserFactoryTests, factoryMissingParameterTypeNameOpenClose)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory<blah> name {}") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 19, compil::Message::p_unknownClassifierType,
                  compil::Message::Type("blah")));
}
TEST_F(ParserIdentifierTests, identifierComment)
{
    ASSERT_FALSE( parseDocument(
        "identifier //") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 12, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 14, compil::Message::p_expectStatementName));
}
TEST_F(ParserFactoryTests, factoryTypeNameCommentOpen)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory<integer> name /* */ {") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 33, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 40, compil::Message::p_unexpectEOFInStatementBody));
}
TEST_F(ParserFactoryTests, factoryTypeCommentName)
{
    ASSERT_FALSE( parseDocument(
        "hierarchy factory<integer> /* */ name") );

    ASSERT_EQ(2U, mpParser->messages().size());
    EXPECT_TRUE(checkWarningMessage(0, 1, 28, compil::Message::p_misplacedComment));
    EXPECT_TRUE(checkErrorMessage(1, 1, 38, compil::Message::p_expectStatementBody));
}
TEST_F(ParserFactoryTests, noTypeFactory)
{
    ASSERT_FALSE( parseDocument(
        "factory") );

    ASSERT_EQ(1U, mpParser->messages().size());
    EXPECT_TRUE(checkErrorMessage(0, 1, 8, compil::Message::p_expectAppropriateType,
                                  compil::Message::Classifier("factory"),
                                  compil::Message::Options("hierarchy, object or plugin")));
}
Example #23
0
bool JsonMSUMessage::parseLogin(const char* message)
{
    cJSON *root = NULL;
    cJSON *data = NULL;
    cJSON *sessionId = NULL;
   
    if ((message == NULL) || (strlen(message) == 0)) {
        LOG.error("%s: invalid JSON message", __FUNCTION__);
        
        return false;
    }
    
    if ((root = cJSON_Parse(message)) == NULL) {
        LOG.error("%s: error parsing JSON message", __FUNCTION__);
        
        return false;
    }
   
    if (checkErrorMessage(root, errorCode, errorMessage)) {
        return false;
    }
   
    // security check: verify if SAPI JSON object is well formed
    // and contains the jsession ID parameter
   
    if ((data = cJSON_GetObjectItem(root, "data")) == NULL) {
        LOG.error("%s: missing data field in json object", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    if ((sessionId = cJSON_GetObjectItem(data, "jsessionid")) == NULL) {
        LOG.error("%s: no session id in JSON object", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    cJSON_Delete(root);
    
    return true;
}
Example #24
0
TEST_F(TokenizerTests, IncorrectBlockCStyleComment)
{
	const char* invalid_comments[] =
	{
		"/*", "/**", "/*/"
	};

	for (size_t i = 0; i < sizeof(invalid_comments) / sizeof(invalid_comments[0]); ++i)
	{
		const char* str = invalid_comments[i];
		mMessageCollector.reset(new compil::MessageCollector());
		mpTokenizer.reset(new compil::Tokenizer(mMessageCollector));

		boost::shared_ptr<std::stringstream> pInput(new std::stringstream(str));
		mpTokenizer->tokenize(compil::SourceIdSPtr(), pInput);
        mpTokenizer->shift();
		EXPECT_FALSE(mpTokenizer->current()) << str;
		EXPECT_TRUE(mpTokenizer->eof()) << str;
		ASSERT_EQ(1U, mMessageCollector->messages().size()) << str;
		EXPECT_TRUE(checkErrorMessage(0, 0, 1, compil::Message::t_unterminatedComment));
	}
}
Example #25
0
int target_run(int modus, char* compiler, char* arguments, char* case_file,
	char* error_file, char* error_line
#ifdef REG_EXTENDED
	, char* gdb, char* gdb_script, regex_t* gdb_pattern
#endif
	)
{
	size_t bufferLen;
	char* buffer;
	int res;
	int testResult;
	int good_error;
	char* logFile;
	char* gdb_scripter;
	int good_gdb;

	bufferLen = 0;
	buffer = NULL;
	res = -1;
	testResult = -1;
	good_error = 0;
	logFile = NULL;
	good_gdb = 0;
	gdb_scripter = NULL;

	if(!(modus & MODE_RUN) && !(modus & MODE_NORUN)){
		fprintf(stderr, "BUG: badly handled mode %i (->run)\n", modus);
		exit(EXIT_FAILURE);
	}

	/* gen command */

	bufferLen = strlen(compiler) + strlen(arguments) + strlen(tmp_dir)
			+ strlen(case_file) * 2 + 64;
	buffer = (char*) malloc(bufferLen);
	snprintf(buffer, bufferLen, "%s %s ", compiler, arguments);

	if(NULL == strstr(buffer, "-od")){
		if(NULL == strstr(buffer, "-of")){
			snprintf(buffer, bufferLen,
				"%s %s -od%s -of%s.exe %s",
				compiler, arguments, tmp_dir, case_file,
				case_file);
		}else{
			snprintf(buffer, bufferLen,
				"%s %s -od%s %s",
				compiler, arguments, tmp_dir, case_file);
		}
	}else if(NULL == strstr(buffer, "-of")){
		snprintf(buffer, bufferLen,
			"%s %s -of%s.exe %s",
			compiler, arguments, case_file, case_file);
	}else{
		snprintf(buffer, bufferLen, "%s %s %s",
			compiler, arguments, case_file);
	}

	/* test 1/3 - compile */
	if(modus & MODE_RUN){
		printf("run: %s\n", buffer);
	}else{
		printf("norun: %s\n", buffer);
	}
	res = crashRun(buffer, &logFile);
	free(buffer);

	/* diagnostic 1/3 */
	buffer = loadFile(logFile, &bufferLen);
	printf("%.*s", (int)bufferLen, buffer);
	remove(logFile);
	free(logFile);

	if(modus & MODE_RUN){
		good_error = checkErrorMessage(error_file, error_line,
			buffer);
	}else{
		good_error = 1;
	}

	testResult = conditionalResult(buffer);
	if(hadExecCrash(buffer)){
		free(buffer);
		return RES_ERROR;
	}else{
		free(buffer);
		if(testResult){
			return testResult;
		}else if((res == EXIT_FAILURE) && good_error){
			return RES_FAIL;
		}else if(res!=EXIT_SUCCESS){
			return RES_ERROR | (good_error ? 0 : RES_BAD_MSG);
		}
	}

	/* test 2/3 - run */
	if((modus & MODE_NORUN) && (strstr(case_file, "/asm_")
				|| strstr(case_file, "\\asm_")
				|| (case_file == strstr(case_file, "asm_"))))
	{
		/* Valgrind doesn't support privileged instructions */
		goto no_valgrind;
	}else if(strstr(case_file, "/asm_") || strstr(case_file, "\\asm_")
			|| (case_file == strstr(case_file, "asm_")))
	{
		/* FIXME asm workaround due to Valgrind bugs (mainly SSE3) */
		goto no_valgrind;
	}else if(VALGRIND){
		bufferLen = strlen(VALGRIND) + strlen(case_file) + 8;
		buffer = (char*) malloc(bufferLen);
		snprintf(buffer, bufferLen, "%s %s.exe", VALGRIND, case_file);
	}else{
no_valgrind:
		bufferLen = strlen(case_file) + 8;
		buffer = (char*) malloc(bufferLen);
		snprintf(buffer, bufferLen, "%s.exe", case_file);
	}
	printf("%s\n", buffer);
	res=crashRun(buffer, &logFile);
	testResult = conditionalResult(buffer);
	if(testResult){
		free(buffer);
		return testResult;
	}
	free(buffer);

	/* diagnostic 2/3 */
	buffer = loadFile(logFile, &bufferLen);
	printf("%.*s\n", (int) bufferLen, buffer);
	remove(logFile);
	free(logFile);

	if(modus & MODE_NORUN){
		good_error = checkRuntimeErrorMessage(error_file, error_line,
				buffer);
	}else{
		good_error = 1;
	}

#ifdef REG_EXTENDED
	if(((res==EXIT_SUCCESS && (modus & MODE_RUN))
			||(res != EXIT_FAILURE && (modus & MODE_NORUN)))
			&& gdb_script != NULL)
	{
		testResult = conditionalResult(buffer);
		if(testResult){
			return testResult;
		}

		free(buffer);
		good_gdb = 0;
		/* test 3/3 - gdb */
		gdb_scripter = genTempFileName();
		writeFile(gdb_scripter, gdb_script);
		bufferLen = strlen(gdb) + strlen(case_file)
			+ strlen(gdb_scripter) + 20;
		buffer = (char*) malloc(bufferLen);
		snprintf(buffer, bufferLen, "%s %s.exe < %s",
			gdb, case_file, gdb_scripter);
		printf("%s\n", buffer);
		if(EXIT_SUCCESS==crashRun(buffer, &logFile)){
			/* diagnostic 3/3 */
			buffer = loadFile(logFile, &bufferLen);
			printf("%.*s\n", (int)bufferLen, buffer);
			good_gdb = (regexec(gdb_pattern, buffer, 0, NULL, 0)==0);
		}
		remove(logFile);
		remove(gdb_scripter);
	}else{
		good_gdb = 1;
	}
#else
	good_gdb = 1;
#endif /* REG_EXTENDED else */

	testResult = conditionalResult(buffer);
	if(testResult){
		return testResult;
	}

	if(modus & MODE_RUN){
		if(hadExecCrash(buffer)){
			testResult = RES_ERROR;
		}else if((res==EXIT_SUCCESS) && good_gdb){
			testResult = RES_PASS;
		}else if((res==EXIT_FAILURE) && good_error && good_gdb){
			testResult = RES_FAIL;
		}else{
			testResult = RES_ERROR | (good_error ? 0 : RES_BAD_MSG)
				| (good_gdb ? 0 : RES_BAD_GDB);
		}
	}else{
		if(res==EXIT_SUCCESS){
			testResult = RES_XPASS;
		}else if(good_error && good_gdb){
			testResult = RES_XFAIL;
		}else{
			testResult = RES_FAIL | (good_error ? 0 : RES_BAD_MSG)
				| (good_gdb ? 0 : RES_BAD_GDB);
		}
	}
	free(buffer);

	return testResult;
}
Example #26
0
bool JsonMSUMessage::parseSignUp(const char* message, std::string& serverErrorMsg)
{
    cJSON *root = NULL, *data = NULL;
    cJSON *status = NULL,
          *user   = NULL;
    int userStatus = cJSON_True;
    
    if ((message == NULL) || (strlen(message) == 0)) {
        LOG.error("%s: invalid JSON message", __FUNCTION__);
        
        return false;
    }
    
    if ((root = cJSON_Parse(message)) == NULL) {
        LOG.error("%s: error parsing JSON message", __FUNCTION__);
        
        return false;
    }
  
    // Check if the result contains an error
    if (checkErrorMessage(root, errorCode, errorMessage)) {
        cJSON* error =  cJSON_GetObjectItem(root, "error");
        std::vector<std::string> params = getParameters(error);
        if (params.size() > 0) {
            // The first parameter is the error message
            serverErrorMsg = params[0];
        }
        
        cJSON_Delete(root);
       
        return false;
    }
    
    if ((data = cJSON_GetObjectItem(root, "data")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find \"data\" field", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
  
        
    if ((user = cJSON_GetObjectItem(data, "user")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find \"user\" field", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    if ((status = cJSON_GetObjectItem(user, "active")) == NULL) {
        cJSON_Delete(root);
        LOG.error("%s: error parsing JSON message: can't find \"status\" field", __FUNCTION__);
      
        return false;
    }
    
    if ((userStatus = status->type) == cJSON_False) {
        LOG.error("%s: user status is not active", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    cJSON_Delete(root);
    
    return true;
}
Example #27
0
bool JsonMSUMessage::parseCaptchaUrl(const char* message, char** captchaUrlStr)
{
    cJSON *root = NULL;
    cJSON *data = NULL;
    cJSON *captchaUrl = NULL;
    cJSON *portalUrl = NULL;
    cJSON *imagePath = NULL;
    cJSON *captchaStatus = NULL;
    
    int captchaStatusValue = cJSON_True;
    const char* portalUrlStr = NULL;
    const char* imagePathStr = NULL;
    int urlLen = 0;
    
    *captchaUrlStr = NULL;
    
    if ((message == NULL) || (strlen(message) == 0)) {
        LOG.error("%s: invalid JSON message", __FUNCTION__);
        
        return false;
    }
    
    if ((root = cJSON_Parse(message)) == NULL) {
        LOG.error("%s: error parsing JSON message", __FUNCTION__);
        
        return false;
    }
    
    if (checkErrorMessage(root, errorCode, errorMessage)) {
        return false;
    }
    
    if ((data = cJSON_GetObjectItem(root, "data")) == NULL) {
        LOG.error("%s: error parsing JSON message: no data field", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    if ((captchaUrl = cJSON_GetObjectItem(data, "captchaurl")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find captcha url", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
  
    if ((captchaStatus = cJSON_GetObjectItem(captchaUrl, "active")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find captcha image status", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
  
    if ((captchaStatusValue = captchaStatus->type) == cJSON_False) {
        LOG.error("%s: captcha image is not active", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    if ((portalUrl = cJSON_GetObjectItem(captchaUrl, "portalurl")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find captcha portal url", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
   
    if ((imagePath = cJSON_GetObjectItem(captchaUrl, "imagepath")) == NULL) {
        LOG.error("%s: error parsing JSON message: can't find captcha image path", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
   
    if (((portalUrlStr = portalUrl->valuestring) == NULL) ||
            ((imagePathStr = imagePath->valuestring) == NULL)) {
        LOG.error("%s: invalid captcha url parameters", __FUNCTION__);
        cJSON_Delete(root);

        return false;
    }
    
    urlLen = strlen(portalUrlStr) + strlen(imagePathStr) + 1;
    
    *captchaUrlStr = new char [urlLen + 1];
    sprintf(*captchaUrlStr, "%s%s", portalUrlStr, imagePathStr);
    
    cJSON_Delete(root);

    return true;
}
Example #28
0
int target_compile(int modus, char* compiler, char* arguments, char* case_file,
		char* error_file, char* error_line)
{
	size_t bufferLen;
	char* buffer;
	int res;
	int testResult;
	int good_error;
	char* logFile;

	bufferLen = 0;
	buffer = NULL;
	res = -1;
	testResult = -1;
	good_error = 0;
	logFile = NULL;

	if(!(modus & MODE_COMPILE) && !(modus & MODE_NOCOMPILE)){
		fprintf(stderr, "BUG: badly handled mode %i (->compile)\n",
			modus);
		exit(EXIT_FAILURE);
	}

	/* gen command */
	bufferLen = strlen(compiler) + strlen(arguments) + strlen(tmp_dir)
		+ strlen(case_file) + 21;
	buffer = (char*) malloc(bufferLen);
	snprintf(buffer, bufferLen, "%s %s ", compiler, arguments);

	if(NULL == strstr(buffer, "-od")){
		snprintf(buffer, bufferLen, "%s %s -od%s -c %s",
			compiler, arguments, tmp_dir, case_file);
	}else{
		snprintf(buffer, bufferLen, "%s %s -c %s",
			compiler, arguments, case_file);
	}

	/* test */
	if(modus & MODE_COMPILE){
		printf("compile: %s\n", buffer);
	}else{
		printf("nocompile: %s\n", buffer);
	}
	res = crashRun(buffer, &logFile);
	free(buffer);

	/* diagnostic */
	buffer = loadFile(logFile, &bufferLen);
	printf("%.*s\n", (int)bufferLen, buffer);
	remove(logFile);
	free(logFile);
	good_error = checkErrorMessage(error_file, error_line, buffer);

	testResult = conditionalResult(buffer);

	if(testResult){
		/* conditional result */
	}else if(hadExecCrash(buffer)){
		testResult = RES_ERROR;
	}else if(modus & MODE_COMPILE){
		if(res == EXIT_SUCCESS){
			testResult = RES_PASS;
		}else if(res == EXIT_FAILURE){
			testResult = RES_FAIL | (good_error ? 0 : RES_BAD_MSG);
		}else{
			testResult = RES_ERROR | (good_error ? 0 : RES_BAD_MSG);
		}
	}else{
		if(res == EXIT_FAILURE){
			if(good_error){
				testResult = RES_XFAIL;
			}else{
				testResult = RES_FAIL | RES_BAD_MSG;
			}
		}else if(res == EXIT_SUCCESS){
			testResult = RES_XPASS;
		}else{
			testResult = RES_ERROR;
		}
	}

	free(buffer);

	return testResult;
}