From 1ec25472b15978f59c13968bbf34221187bdcc22 Mon Sep 17 00:00:00 2001 From: Mikhail Nazarov Date: Mon, 21 Apr 2014 21:31:26 +0400 Subject: [PATCH 1/4] .travis.yml: version with make, make test and debug output --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..71d4f7d7e6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: c +compiler: + - gcc + +before_install: "sudo apt-get update && sudo apt-get install -y linux-libc-dev" + +script: + - make && cd src && sudo make test_ci; + +after_script: + - ls testlog/* | xargs -l1 cat; From b5eaebe1f36941b06ef2fdca4e63798bba7deea4 Mon Sep 17 00:00:00 2001 From: Mikhail Nazarov Date: Sun, 20 Apr 2014 20:45:09 +0400 Subject: [PATCH 2/4] src/core/memory: use 'huge allocator' only if available --- src/core/memory.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/memory.lua b/src/core/memory.lua index 7a17eeeb39..1b615cf825 100644 --- a/src/core/memory.lua +++ b/src/core/memory.lua @@ -122,7 +122,7 @@ function set_use_physical_memory() end function set_default_allocator(use_hugetlb) - if use_hugetlb then + if use_hugetlb and lib.can_write("/proc/sys/vm/nr_hugepages") then allocate_RAM = function(size) for i =1, 3 do local page = C.allocate_huge_page(size) From 83a68be66e7653cfdf30dee0fc9cc693f6d7a07c Mon Sep 17 00:00:00 2001 From: Mikhail Nazarov Date: Sun, 20 Apr 2014 20:46:12 +0400 Subject: [PATCH 3/4] src/core/memory: use base page size as default value --- src/core/memory.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/memory.lua b/src/core/memory.lua index 1b615cf825..9bb93faefb 100644 --- a/src/core/memory.lua +++ b/src/core/memory.lua @@ -72,7 +72,7 @@ function get_huge_page_size () local _,_,hugesize = meminfo:find("Hugepagesize: +([0-9]+) kB") return hugesize and tonumber(hugesize) * 1024 - or 2048 -- A typical x86 system will have a Huge Page Size of 2048 kBytes + or base_page_size -- use base page size as default value end base_page_size = 4096 From 4086bf2ff566b4b2d62c0044ce61edb46d77d268 Mon Sep 17 00:00:00 2001 From: Mikhail Nazarov Date: Sun, 20 Apr 2014 21:07:00 +0400 Subject: [PATCH 4/4] src/apps/vhost/[vhost|vhost_apps]: run test only if /dev/net/tun exists --- src/apps/vhost/vhost.lua | 5 +++++ src/apps/vhost/vhost_apps.lua | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/apps/vhost/vhost.lua b/src/apps/vhost/vhost.lua index 0a25949cac..fbbbcdae6e 100644 --- a/src/apps/vhost/vhost.lua +++ b/src/apps/vhost/vhost.lua @@ -3,6 +3,7 @@ module(...,package.seeall) local ffi = require("ffi") local C = ffi.C +local lib = require("core.lib") local freelist = require("core.freelist") local memory = require("core.memory") local buffer = require("core.buffer") @@ -15,6 +16,10 @@ local packet = require("core.packet") vring_size = C.VHOST_VRING_SIZE uint64_t = ffi.typeof("uint64_t") +function is_tuntap_available() + return lib.can_write("/dev/net/tun") +end + function new (tapname) local vhost = ffi.new("struct vhost") local dev = { vhost = vhost, diff --git a/src/apps/vhost/vhost_apps.lua b/src/apps/vhost/vhost_apps.lua index 2e1a780f57..26acee9292 100644 --- a/src/apps/vhost/vhost_apps.lua +++ b/src/apps/vhost/vhost_apps.lua @@ -40,6 +40,11 @@ function TapVhost:push () end function selftest () + if not vhost.is_tuntap_available() then + print("/dev/net/tun absent or not avaiable\nTest skipped") + os.exit(app.test_skipped_code) + end + local c = config.new() config.app(c, "source", basic_apps.Source) config.app(c, "tapvhost", TapVhost, "snabb%d")