The Kraken compiler now compiles programs automatically, moving this functionality from the tester in preperation for making test_compiler not a test

This commit is contained in:
Nathan Braswell
2016-01-24 03:14:24 -05:00
parent 105a969a00
commit 9f714dc9ec
5 changed files with 12 additions and 9 deletions

View File

@@ -12,7 +12,6 @@ class Tester {
public:
Tester(std::string krakenInvocation, std::string krakenGrammerLocation);
~Tester();
int ssystem(std::string command);
bool run(std::string fileName);
bool compareFiles(std::string file1Path, std::string file2Path);
void cleanExtras(std::string path);

View File

@@ -13,6 +13,7 @@
#include <fstream>
#include <cstring>
int ssystem(std::string command);
std::string intToString(int theInt);
std::string replaceExEscape(std::string first, std::string search, std::string replace);
std::string strSlice(std::string str, int begin, int end);

View File

@@ -37,9 +37,12 @@ void CGenerator::generateCompSet(std::map<std::string, NodeTree<ASTData>*> ASTs,
buildString += linkerString;
buildString += "-o " + outputName;
std::ofstream outputBuild;
outputBuild.open(outputName + "/" + split(outputName, '/').back() + ".sh");
std::string scriptName = split(outputName, '/').back() + ".sh";
outputBuild.open(outputName + "/" + scriptName);
outputBuild << buildString;
outputBuild.close();
std::cout << "KRAKEN COMPILING DONE, CALLING C COMPILER" << std::endl;
ssystem("cd " + outputName + "/; sh " + scriptName);
std::cout << "DEFER DOUBLE STACK " << deferDoubleStack.size() << std::endl;
}

View File

@@ -17,10 +17,6 @@ Tester::~Tester() {
//Nothing
}
int Tester::ssystem(std::string command) {
return system(command.c_str());
}
void Tester::cleanExtras(std::string fileName) {
ssystem(removeCmd + " " + fileName);
}
@@ -31,9 +27,10 @@ bool Tester::run(std::string path) {
cleanExtras(path);
ssystem(krakenInvocation + " " + path + krakenExtention + " " + path);
ssystem(changePermissions + " " + path + sep + fileName + ".sh");
ssystem(cd + " " + path + "; " + "./" + fileName + ".sh");
ssystem(changePermissions + " " + path + sep + fileName);
// done automatically now
//ssystem(changePermissions + " " + path + sep + fileName + ".sh");
//ssystem(cd + " " + path + "; " + "./" + fileName + ".sh");
//ssystem(changePermissions + " " + path + sep + fileName);
ssystem(path + sep + fileName + " " + redirect + " " + path + sep + fileName + resultsExtention);
bool result = compareFiles(fileName + expectedExtention, path + sep + fileName + resultsExtention);

View File

@@ -1,5 +1,8 @@
#include "util.h"
int ssystem(std::string command) {
return system(command.c_str());
}
std::string intToString(int theInt) {
std::stringstream converter;
converter << theInt;