From fb617ad2e22c3c7ad705cb6748da57b5417985b2 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 3 Dec 2019 06:27:15 +1000 Subject: Test and report speed. --- apt-panopticon-report-email-web.lua | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'apt-panopticon-report-email-web.lua') diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index fc1f345..131c803 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -75,6 +75,11 @@ dumpTableHTMLSub = function (table, space) return r end +local checkFile = function(f) + local h, e = io.open(f, "r") + if nil == h then return false else h:close(); return true end +end + local plurals = function(e, w) local result = "" if 1 == e then @@ -393,7 +398,7 @@ if nil == web then C("opening mirrors file - " .. e) else "https://pkgmaster.devuan.org/mirror_list.txt

\n" .. "

Due to the nature of the tests, some errors or warnings will be counted several times.   " .. "The links in the table and DNS list go to the detailed testing logs.

\n\n" .. - "
\n

==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====

\n\n" .. + "
\n

==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====

\n" .. "

[FAILED] or [OK]" .. " means the tested thing is supported for that mirror.

\n" .. @@ -407,7 +412,8 @@ if nil == web then C("opening mirrors file - " .. e) else "

The time in the Updated column is how often the mirror updates itself.

" .. "

Mirrors with a grey background are not active (though may be usable as part of the DNS-RR).

\n" .. "

[skip] means that the test hasn't been written yet.

\n" .. - "\n" + "
FTPHTTPHTTPSRSYNCDNS round robinProtocolURL sanityIntegrityUpdated
\n" .. + "\n" ) for k, v in orderedPairs(mirrors) do local results = loadfile("results/" .. k .. ".lua")() @@ -439,6 +445,7 @@ if nil == web then C("opening mirrors file - " .. e) else local updated = status(k, results, "Updated") local rate = v.Rate if nil ~= rate then updated = updated .. ' ' .. rate end + local min, max, spd = 999999999999, 0, '' -- DNS-RR test. if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then @@ -470,11 +477,34 @@ if nil == web then C("opening mirrors file - " .. e) else end end if "" == dns then dns = "[no]" end + + for i, mt in pairs({'Release', 'Packages', 'META'}) do + if checkFile("results/curl-" .. mt .. "-" .. k .. ".log") then + for l in io.lines("results/curl-" .. mt .. "-" .. k .. ".log") do + local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)') + if nil ~= speed then + if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end + if 'k' == crrnt:sub(-1, -1) then crrnt = crrnt:sub(1, -2) .. '000' end + speed = tonumber(speed) + crrnt = tonumber(crrnt) + if speed < min and speed ~= 0 then min = speed end + if speed > max then max = speed end + if crrnt < min and crrnt ~= 0 then min = crrnt end + if crrnt > max then max = crrnt end + end + end + end + end + if 0 == max then + spd = '' + else + spd = string.format('', min, max) + end end web:write("\n") + " " .. spd .. "\n") if "" ~= v.Active then web:write("\n") end -- cgit v1.1
FTPHTTPHTTPSRSYNCDNS round robinProtocolURL sanityIntegrityUpdatedSpeed
%d ->%d" .. ftp .. " " .. http .. " " .. https .. " " .. rsync .. " " .. dns .. " " .. protocol .. " " .. sanity .. - " " .. integrity .. " " .. updated .. "
" .. integrity .. " " .. updated .. " 
" .. active .. "