Merge pull request #3415 from cuberite/FailCIOnApiProblem
CI: API test defaults to failure, unless explicitly succeeded.
This commit is contained in:
commit
471ae7e47b
@ -19,6 +19,7 @@ make -j 2 test ARGS="-V";
|
|||||||
|
|
||||||
echo "Testing..."
|
echo "Testing..."
|
||||||
cd Server/;
|
cd Server/;
|
||||||
|
touch apiCheckFailed.flag
|
||||||
if [ "$TRAVIS_CUBERITE_BUILD_TYPE" != "COVERAGE" ]; then
|
if [ "$TRAVIS_CUBERITE_BUILD_TYPE" != "COVERAGE" ]; then
|
||||||
$CUBERITE_PATH << EOF
|
$CUBERITE_PATH << EOF
|
||||||
load APIDump
|
load APIDump
|
||||||
@ -36,4 +37,8 @@ EOF
|
|||||||
cat ./DuplicateDocs.txt
|
cat ./DuplicateDocs.txt
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ -f ./apiCheckFailed.flag ]; then
|
||||||
|
echo "ERROR: API check has failed with an unknown error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -26,13 +26,10 @@ local function LoadAPIFiles(a_Folder, a_DstTable)
|
|||||||
local FileName = Folder .. fnam;
|
local FileName = Folder .. fnam;
|
||||||
-- We only want .lua files from the folder:
|
-- We only want .lua files from the folder:
|
||||||
if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then
|
if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then
|
||||||
local TablesFn, Err = loadfile(FileName);
|
local TablesFn = assert(loadfile(FileName))
|
||||||
if (type(TablesFn) ~= "function") then
|
local Tables = TablesFn()
|
||||||
LOGWARNING("Cannot load API descriptions from " .. FileName .. ", Lua error '" .. Err .. "'.");
|
|
||||||
else
|
|
||||||
local Tables = TablesFn();
|
|
||||||
if (type(Tables) ~= "table") then
|
if (type(Tables) ~= "table") then
|
||||||
LOGWARNING("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").");
|
error("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
for k, cls in pairs(Tables) do
|
for k, cls in pairs(Tables) do
|
||||||
@ -46,9 +43,8 @@ local function LoadAPIFiles(a_Folder, a_DstTable)
|
|||||||
f:write(k, "\t", FileName)
|
f:write(k, "\t", FileName)
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
a_DstTable[k] = cls;
|
a_DstTable[k] = cls
|
||||||
end
|
end
|
||||||
end -- if (TablesFn)
|
|
||||||
end -- if (is lua file)
|
end -- if (is lua file)
|
||||||
end -- for fnam - Folder[]
|
end -- for fnam - Folder[]
|
||||||
end
|
end
|
||||||
@ -2040,6 +2036,9 @@ local function HandleCmdApiCheck(a_Split, a_EntireCmd)
|
|||||||
return true, "Found new undocumented symbols:\n" .. table.concat(newUndocumented, "\n")
|
return true, "Found new undocumented symbols:\n" .. table.concat(newUndocumented, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- The check completed successfully, remove the "test failed" flag from the filesystem:
|
||||||
|
cFile:DeleteFile("apiCheckFailed.flag")
|
||||||
|
|
||||||
return true, "API check completed successfully"
|
return true, "API check completed successfully"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user