Headless: Cleanup TeamCity handling in test.py.

This commit is contained in:
Unknown W. Brackets 2020-12-30 13:55:53 -08:00
parent 52c6169a59
commit af7c97d624
3 changed files with 11 additions and 16 deletions

View file

@ -49,7 +49,7 @@ void TeamCityPrint(const char *fmt, ...)
temp[TEMP_BUFFER_SIZE - 1] = '\0';
va_end(args);
printf("%s", temp);
printf("##teamcity[%s]\n", temp);
}
struct BufferedLineReader {
@ -223,7 +223,7 @@ bool CompareOutput(const std::string &bootFilename, const std::string &output, b
if (!failed)
{
TeamCityPrint("##teamcity[testFailed name='%s' message='Output different from expected file']\n", teamCityName.c_str());
TeamCityPrint("testFailed name='%s' message='Output different from expected file'", teamCityName.c_str());
failed = true;
}
@ -277,7 +277,7 @@ bool CompareOutput(const std::string &bootFilename, const std::string &output, b
else
{
fprintf(stderr, "Expectation file %s not found\n", expect_filename.c_str());
TeamCityPrint("##teamcity[testIgnored name='%s' message='Expects file missing']\n", teamCityName.c_str());
TeamCityPrint("testIgnored name='%s' message='Expects file missing'", teamCityName.c_str());
return false;
}
}

View file

@ -161,11 +161,11 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
if (!PSP_Init(coreParameter, &error_string)) {
fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n");
TeamCityPrint("##teamcity[testIgnored name='%s' message='PRX/ELF missing']\n", teamCityName.c_str());
TeamCityPrint("testIgnored name='%s' message='PRX/ELF missing'", teamCityName.c_str());
return false;
}
TeamCityPrint("##teamcity[testStarted name='%s' captureStandardOutput='true']\n", teamCityName.c_str());
TeamCityPrint("testStarted name='%s' captureStandardOutput='true'", teamCityName.c_str());
host->BootDone();
@ -201,7 +201,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
passed = false;
host->SendDebugOutput("TIMEOUT\n");
TeamCityPrint("##teamcity[testFailed name='%s' message='Test timeout']\n", teamCityName.c_str());
TeamCityPrint("testFailed name='%s' message='Test timeout'", teamCityName.c_str());
Core_Stop();
}
}
@ -217,7 +217,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
if (autoCompare && passed)
passed = CompareOutput(coreParameter.fileToStart, output, verbose);
TeamCityPrint("##teamcity[testFinished name='%s']\n", teamCityName.c_str());
TeamCityPrint("testFinished name='%s'", teamCityName.c_str());
return passed;
}

13
test.py
View file

@ -21,12 +21,14 @@ PPSSPP_EXECUTABLES = [
"build*/MinSizeRel/PPSSPPHeadless",
# Linux
"build*/PPSSPPHeadless",
"./PPSSPPHeadless"
"./PPSSPPHeadless",
# CI
"ppsspp/PPSSPPHeadless",
"ppsspp\\PPSSPPHeadless.exe",
]
PPSSPP_EXE = None
TEST_ROOT = "pspautotests/tests/"
teamcity_mode = False
TIMEOUT = 5
class Command(object):
@ -369,11 +371,6 @@ def init():
print("PPSSPPHeadless executable missing, please build one.")
sys.exit(1)
def tcprint(arg):
global teamcity_mode
if teamcity_mode:
print(arg)
def run_tests(test_list, args):
global PPSSPP_EXE, TIMEOUT
tests_passed = []
@ -401,13 +398,11 @@ def run_tests(test_list, args):
def main():
global teamcity_mode
init()
tests = []
args = []
for arg in sys.argv[1:]:
if arg == '--teamcity':
teamcity_mode = True
args.append(arg)
elif arg[0] == '-':
args.append(arg)