google / google/googletest

Death test fails on system with specific locales on Windows

Open
#3,196 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

Hi,

Death test fails for me because of the line https://github.com/google/googletest/blob/master/googletest/src/gtest-death-test.cc#L765
In my locale (RU) numbers have grouping of 3: `123 456 789`.
On that line process id (win32) is printed like `1 234` or `12 345`.
Child program cannot parse it with space on the line https://github.com/google/googletest/blob/master/googletest/src/gtest-death-test.cc#L1606

Obvious easy fix is to eat spaces in pid string on the line https://github.com/google/googletest/blob/master/googletest/src/gtest-death-test.cc#L1606
```
fields[3].erase(std::remove_if(fields[3].begin(), fields[3].end(), isspace), fields[3].end());
```
Proper fix is to eat all spaces on the parent side.

Wrong (?) fix is to set C locale always for all tests. This is probably wrong, because we want to test programs in any locale (including current one).
Or we can add ability to set gtest locale using command line option.

Contributor guide

Open the contributing guide

Research direction

Start in googletest/src/gtest-death-test.cc at the Windows process-ID formatting around line 765 and parsing around line 1606. Reproduce the death-test failure under a locale that groups digits with spaces, then verify that death tests parse the process ID correctly without forcing all tests to use the C locale.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.