Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests vm vs docker #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,8 @@ dmypy.json
# Pyre type checker
.pyre/

**/*.txt
**/*.png
**/*.csv
**/*.vm
**/*.docker
52 changes: 52 additions & 0 deletions tests/docker-vm/vnf-vm/graphs.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env Rscript

print_boxplot = function(data, path, name) {
png(filename=sprintf("%s/%sGraph.png", path, name))
names = structure(list(range01(data[,1]), range01(data[,2])), .Names = c("Virtual Box", "Docker"), class = "data.frame")
boxplot(names)
dev.off()
}

print_pie = function(data, path, name) {
png(filename=sprintf("%s/%sGraph.png", path, name))
pie(
c(sum(data[,1]), sum(data[,2])),
col=c("darkgreen", "darkred"),
labels = c("Virtual Box", "Docker"),
main = "Docker vs VM start up times")
dev.off()
}

print_barplot = function(data, path, name) {
png(filename=sprintf("%s/%sGraph.png", path, name))
barplot(
c(log(sum(data[,1])), log(sum(data[,2]))),
# main="Docker vs Virtual Machine startup times",
col=c("darkgreen", "darkred"),
ylim=c(0, round(log((max(sum(data[,1]), sum(data[,2])))) / 5))*5,
names.arg=c("Virtual Box", "Docker"),
cex.lab=2,
cex.axis=2,
cex.names=2,
cex.main=2)
mtext(side=2, line=3, text="log(seconds)")
dev.off()
}

range01 = function(x) {
(x-min(x))/(max(x)-min(x))
}

append = function(x, y) {
paste(x, y, sep='')
}

args = commandArgs(trailingOnly=TRUE)
if (length(args) < 2) {
stop("At least three arguments must be supplied (path to the data, path where to save the graphs and name prefix).n", call.=FALSE)
} else {
data = read.csv(args[1], sep=",")
print_pie(data, args[2], append(args[3], 'Pie'))
print_barplot(data, args[2], append(args[3], 'Barplot'))
print_boxplot(data, args[2], append(args[3], 'Boxplot'))
}
1 change: 1 addition & 0 deletions tests/docker-vm/vnf-vm/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function main() {
check_docker $2 $4 "$1.docker" $5

msg info "Tests finished. Output file: $1. Number of tests performed: $2. Bye!"
./zip.py "$1"
}

main $@
28 changes: 28 additions & 0 deletions tests/docker-vm/vnf-vm/zip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/python3

import sys
import csv

def get_lines(filename):
with open(filename) as f:
content = f.readlines()
return [x.strip() for x in content]


def zip_res(filenames):
docker = filenames + ".docker"
vm = filenames + ".vm"
docker_lines = get_lines(docker)
vm_lines = get_lines(vm)

zipped_lines = zip(vm_lines, docker_lines)

with open('result.csv', mode='w') as result_file:
result_writer = csv.writer(result_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

result_writer.writerow(['VirtualBox', 'Docker'])
result_writer.writerows(zipped_lines)


if __name__ == '__main__':
zip_res(sys.argv[1])