Commit e8303817 authored by yiwenshao's avatar yiwenshao

add constants and add tests

parent 58e2c191
......@@ -77,6 +77,7 @@ $(OBJDIR)/%.o: $(OBJDIR)/%.cc
$(CXX) -MD $(CXXFLAGS) -c $< -o $@
##rules for .cc in debug directory
mtl/%:$(OBJDIR)/debug/%.o $(OBJDIR)/libwrapper.so
@mkdir -p $(@D)
$(CXX) -g -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -L/$(MYBUILD)/libmysqld -lmysqld -laio -lz -ldl -lm -lcrypt -lpthread -lwrapper -lcryptdb -ledbcrypto -ledbutil -ledbparser -lntl -lcrypto
......@@ -87,6 +88,10 @@ mtl/test_wrapper_exe/%:$(OBJDIR)/test_wrapper/%.o $(OBJDIR)/libwrapper.so
$(CXX) -g -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -L/$(MYBUILD)/libmysqld -lmysqld -laio -lz -ldl -lm -lcrypt -lpthread -lwrapper -lcryptdb -ledbcrypto -ledbutil -ledbparser -lntl -lcrypto
mtl/test_util_exe/%:$(OBJDIR)/test_util/%.o
@mkdir -p $(@D)
$(CXX) -g -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -L/$(MYBUILD)/libmysqld -lmysqld -laio -lz -ldl -lm -lcrypt -lpthread -lcryptdb -ledbcrypto -ledbutil -ledbparser -lntl -lcrypto
include crypto/Makefrag
include parser/Makefrag
......@@ -96,6 +101,7 @@ include udf/Makefrag
include mysqlproxy/Makefrag
include debug/Makefrag
include test_wrapper/Makefrag
include test_util/Makefrag
include wrapper/Makefrag
......
loadCount:3
loadCount:5
pipelineCount:1000
other:1
source setup.sh
echo "./mtl/test_util_exe/verify_constants"
./mtl/test_util_exe/verify_constants
echo ==================================================================
OBJDIRS += test_util
##note that xx=*.cc will not expand. wildcard *.cc will include files from other directories.
##%.o will include testall
TESTALL_OBJS := $(patsubst %.cc,$(OBJDIR)/%.o,$(wildcard test_util/*.cc))
TESTALL_EXES := $(patsubst test_util/%.cc,mtl/test_util_exe/%,$(wildcard test_util/*.cc))
all: $(TESTALL_OBJS) $(TESTALL_EXES)
#include "util/constants.hh"
#include <iostream>
using std::cout;
using std::endl;
int
main(){
cout<<"loadCount:"<<constGlobalConstants.loadCount<<endl;
cout<<"pipilineCount:"<<constGlobalConstants.pipelineCount<<endl;
cout<<"logFile:"<<constGlobalConstants.logFile<<endl;
return 0;
}
......@@ -22,13 +22,19 @@ globalConstants initGlobalConstants(){
int index = line.find(":");
std::string head = line.substr(0,index);
if(head=="loadCount"){
res.loadCount=stoi(line.substr(index+1));
res.loadCount = stoi(line.substr(index+1));
}else if(head=="pipelineCount"){
res.pipelineCount = stoi(line.substr(index+1));
}else if(head=="other"){
;
}else{
assert(0);
}
}
/* the following values need not be determined
at runtime.*/
res.logFile="LOG.TXT";
infile.close();
return res;
}
......
......@@ -4,12 +4,15 @@
added by et. all et related things.
*/
#include<assert.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string>
struct globalConstants{
int loadCount;/*used to limit the number of final_load*/
int pipelineCount;
std::string logFile;/*file name for log*/
};
extern const char* cryptdb_dir;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment