From 91a1d53ce21f0db12796318679944d8fdf4f1665 Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Wed, 20 Jan 2010 12:06:25 +0100 Subject: [PATCH] cleanup: remove unused code Signed-off-by: Gordon Hecker --- generic/e2lib.lua | 79 ----------------------------------------------- 1 file changed, 79 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 1608301..ddb4a91 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -454,23 +454,6 @@ function e2lib.rotate_log(file) return true, nil end -local buildidlogfile = false - -function e2lib.buildidlog(info, text) - if info then - if not buildidlogfile then - e2lib.mkdir(info.root .. "/log", "-p") - buildidlogfile = io.open(info.root .. "/log/buildid.log", "a+") - end - buildidlogfile:write(text .. "\n") - else - buildidlogfile:write(" time: ", os.time(), "\n", - "------------------------------------------\n") - buildidlogfile:close() - buildidlogfile = false - end -end - --- append a line to a file -- @param file string: filename -- @param line string: a line to append to the file @@ -679,68 +662,6 @@ function e2lib.howtounpack(physpath, virtpath, destdir) return c end - --- Unit test support --- --- e2lib.testsuite([NAME]) --- --- With an argument: starts a suite of tests. Without an argument: finishes --- a testsuite. NAME should be a string describing the testsuite. All --- invocations of e2lib.check() inside a pair of e2lib.testsuite() calls --- are grouped together. --- --- e2lib.check(RESULT, EXPECTED, [NAME]) --- --- Compares RESULT with EXPECTED and records whether both are structurally --- equal (using table.compare if needed). NAME can be given for diagnostic --- output. --- --- See e2-run-tests for an example of using this facility. - -local testcount = 0 - -function e2lib.testsuite(name) - if name then - testcount = 1 - io.stderr:write("--- starting testsuite: \t", name, "\n") - e2lib.current_testsuite = name - e2lib.succeeded_tests = 0 - e2lib.failed_tests = 0 - elseif e2lib.current_testsuite then - io.stderr:write("--- finishing testsuite:\t", e2lib.current_testsuite, "\n") - io.stderr:write(" tests succeeded:\t", e2lib.succeeded_tests, "\n") - io.stderr:write(" failed:\t", e2lib.failed_tests, "\n") - if e2lib.failed_tests == 0 then - io.stderr:write(" ALL TESTS SUCCEEDED.\n") - else - io.stderr:write(" SOME TESTS FAILED.\n") - end - else error("no testsuite active") end -end - -function e2lib.check(result, expected, name) - if name then io.write(name, " ...") - else io.write("test #", testcount, " ...") end - io.flush() - testcount = testcount + 1 - local f - if type(expected) == "table" then - if type(result) == "table" then - f = table.compare(result, expected) - else - f = false - end - else f = expected == result end - if f then - e2lib.succeeded_tests = (e2lib.succeeded_tests or 0) + 1 - print("\tok") - else - e2lib.failed_tests = (e2lib.failed_tests or 0) + 1 - io.write("\tfailed - expected: ", expected, " but got: ", result, "\n") - end -end - - -- Input/Output operations -- -- e2lib.read_line(PATHNAME) -- 2.39.5