Skip to content
Snippets Groups Projects
Commit a733cfde authored by Rahul Shivaprasad's avatar Rahul Shivaprasad
Browse files

last second changes

parent cc3d947c
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ var addr = vm_addr
func main() {
flag.Parse()
args := os.Args[1:]
start := time.Now()
conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
......@@ -42,9 +43,11 @@ func main() {
if err != nil {
log.Printf("could not grep!: %v", err)
} else {
duration := time.Since(start)
for _, item := range r.GetResult() {
fmt.Printf("%s", item)
}
fmt.Printf("Total Matches : %d\n", r.GetTotal())
fmt.Printf("\nTotal Matches : %d\n", r.GetTotal())
fmt.Printf("Query Time : %v\n", duration)
}
}
......@@ -5,6 +5,7 @@ Script for integration testing distributed grep.
import os
import re
import time
CLIENT_FILE = "client.go"
OPTIONS = "c"
......@@ -127,11 +128,12 @@ def assert_test(out,pattern,testname):
def assert_negative(out,testname,killed_process,pattern):
parsed_output = parse_output(out)
for file,count in RIGHT_ANSWERS[pattern].items():
if file == "tests/test{}.log".format(killed_process) and file in parsed_output:
print("TEST {} FAILED".format(testname))
return
if file == "tests/test{}.log".format(killed_process):
if file in parsed_output:
print("lame {} TEST {} FAILED".format(file,testname))
return
elif file not in parsed_output or parsed_output[file]!=count:
print("TEST {} FAILED".format(testname))
print("lamest {} TEST {} FAILED".format(file,testname))
return
print("TEST {} PASSED".format(testname))
......@@ -198,8 +200,9 @@ def TestDistributedGrepKillRandomWorker():
out = runDistGrep(OPTIONS,pattern,file_name)
print(out)
assert_negative(out,"TestDistributedGrepKillRandomWorker",killed_process,pattern)
delete_logs()
os.system("ssh fa22-cs425-030{} 'cd /mp1/cs425-mp1 ; go run worker/worker_server.go > /dev/null 2>&1 &'".format(killed_process))
time.sleep(5)
delete_logs()
TestDistributedGrepInfrequentWord()
TestDistributedGrepFrequentWord()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment