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:
@@ -12,7 +12,6 @@ class Tester {
|
|||||||
public:
|
public:
|
||||||
Tester(std::string krakenInvocation, std::string krakenGrammerLocation);
|
Tester(std::string krakenInvocation, std::string krakenGrammerLocation);
|
||||||
~Tester();
|
~Tester();
|
||||||
int ssystem(std::string command);
|
|
||||||
bool run(std::string fileName);
|
bool run(std::string fileName);
|
||||||
bool compareFiles(std::string file1Path, std::string file2Path);
|
bool compareFiles(std::string file1Path, std::string file2Path);
|
||||||
void cleanExtras(std::string path);
|
void cleanExtras(std::string path);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
int ssystem(std::string command);
|
||||||
std::string intToString(int theInt);
|
std::string intToString(int theInt);
|
||||||
std::string replaceExEscape(std::string first, std::string search, std::string replace);
|
std::string replaceExEscape(std::string first, std::string search, std::string replace);
|
||||||
std::string strSlice(std::string str, int begin, int end);
|
std::string strSlice(std::string str, int begin, int end);
|
||||||
|
|||||||
@@ -37,9 +37,12 @@ void CGenerator::generateCompSet(std::map<std::string, NodeTree<ASTData>*> ASTs,
|
|||||||
buildString += linkerString;
|
buildString += linkerString;
|
||||||
buildString += "-o " + outputName;
|
buildString += "-o " + outputName;
|
||||||
std::ofstream outputBuild;
|
std::ofstream outputBuild;
|
||||||
outputBuild.open(outputName + "/" + split(outputName, '/').back() + ".sh");
|
std::string scriptName = split(outputName, '/').back() + ".sh";
|
||||||
|
outputBuild.open(outputName + "/" + scriptName);
|
||||||
outputBuild << buildString;
|
outputBuild << buildString;
|
||||||
outputBuild.close();
|
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;
|
std::cout << "DEFER DOUBLE STACK " << deferDoubleStack.size() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ Tester::~Tester() {
|
|||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tester::ssystem(std::string command) {
|
|
||||||
return system(command.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tester::cleanExtras(std::string fileName) {
|
void Tester::cleanExtras(std::string fileName) {
|
||||||
ssystem(removeCmd + " " + fileName);
|
ssystem(removeCmd + " " + fileName);
|
||||||
}
|
}
|
||||||
@@ -31,9 +27,10 @@ bool Tester::run(std::string path) {
|
|||||||
|
|
||||||
cleanExtras(path);
|
cleanExtras(path);
|
||||||
ssystem(krakenInvocation + " " + path + krakenExtention + " " + path);
|
ssystem(krakenInvocation + " " + path + krakenExtention + " " + path);
|
||||||
ssystem(changePermissions + " " + path + sep + fileName + ".sh");
|
// done automatically now
|
||||||
ssystem(cd + " " + path + "; " + "./" + fileName + ".sh");
|
//ssystem(changePermissions + " " + path + sep + fileName + ".sh");
|
||||||
ssystem(changePermissions + " " + path + sep + fileName);
|
//ssystem(cd + " " + path + "; " + "./" + fileName + ".sh");
|
||||||
|
//ssystem(changePermissions + " " + path + sep + fileName);
|
||||||
ssystem(path + sep + fileName + " " + redirect + " " + path + sep + fileName + resultsExtention);
|
ssystem(path + sep + fileName + " " + redirect + " " + path + sep + fileName + resultsExtention);
|
||||||
|
|
||||||
bool result = compareFiles(fileName + expectedExtention, path + sep + fileName + resultsExtention);
|
bool result = compareFiles(fileName + expectedExtention, path + sep + fileName + resultsExtention);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
int ssystem(std::string command) {
|
||||||
|
return system(command.c_str());
|
||||||
|
}
|
||||||
std::string intToString(int theInt) {
|
std::string intToString(int theInt) {
|
||||||
std::stringstream converter;
|
std::stringstream converter;
|
||||||
converter << theInt;
|
converter << theInt;
|
||||||
|
|||||||
Reference in New Issue
Block a user