[igt-dev] (no subject)

Tomi Sarvela tomi.p.sarvela at intel.com
Thu Sep 27 05:57:02 UTC 2018


On 9/26/18 5:58 PM, Martin Peres wrote:
> On 26/09/2018 15:24, Petri Latvala wrote:
>> CI pipeline (namely, cibuglog) doesn't cope well with strings that
>> have \0 in them. If null characters appear in output files, pretend
>> the output stops at the first such character. Well behaving tests
>> should not print them anyway.
>>
>> The case in CI happened due to some hang/crash/explosion/solar flare
>> that corrupted the output of a test.
>>
>> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
>> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
>> Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
>> Cc: Martin Peres <martin.peres at linux.intel.com>
> 
> Acked-by: Martin Peres <martin.peres at linux.intel.com>

The original reason was very probably a hang/panic/reboot before flushed 
fd was written to the disk. Result was about one lines worth of NULLs 
(which, in itself, shows that the logwriter is significantly more 
careful than piglits one).

If the expectation is that the out/err files are text, I think runner 
can safely discard the rest from any indication of data corruption.

Acked-by: Tomi Sarvela <tomi.p.sarvela at intel.com>

> 
>> ---
>>   runner/resultgen.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/runner/resultgen.c b/runner/resultgen.c
>> index d34b52db..e8a60083 100644
>> --- a/runner/resultgen.c
>> +++ b/runner/resultgen.c
>> @@ -313,7 +313,7 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
>>   			     struct subtests *subtests,
>>   			     struct json_object *tests)
>>   {
>> -	char *buf, *bufend;
>> +	char *buf, *bufend, *nullchr;
>>   	struct stat statbuf;
>>   	char piglit_name[256];
>>   	char *igt_version = NULL;
>> @@ -332,6 +332,14 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
>>   		buf = NULL;
>>   	}
>>   
>> +	/*
>> +	 * Avoid null characters: Just pretend the output stops at the
>> +	 * first such character, if any.
>> +	 */
>> +	if ((nullchr = memchr(buf, '\0', statbuf.st_size)) != NULL) {
>> +		statbuf.st_size = nullchr - buf;
>> +	}
>> +
>>   	bufend = buf + statbuf.st_size;
>>   
>>   	igt_version = find_line_starting_with(buf, IGT_VERSIONSTRING, bufend);
>>
> 


Tomi
-- 
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo


More information about the igt-dev mailing list