Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case failed on chain_test #1326

Closed
1 of 17 tasks
HarukaMa opened this issue Sep 14, 2018 · 6 comments
Closed
1 of 17 tasks

Test case failed on chain_test #1326

HarukaMa opened this issue Sep 14, 2018 · 6 comments

Comments

@HarukaMa
Copy link
Contributor

HarukaMa commented Sep 14, 2018

Instructions
I've been testing building with Boost 1.67.0, and the compilation succeeded despite it is not supported, so I decided to run tests (*_test) to check for errors.

When running chain_test, I've met one error:

unknown location:0: fatal error: in "uia_tests/asset_name_test": std::runtime_error: collate_byname<char>::collate_byname failed to construct for en_US.UTF8
/Users/MrX/src/bitshares-core/tests/tests/uia_tests.cpp:503: last checkpoint

other tests except es_test (didn't have es installation locally) succeeded without errors.

Additional info:

$ locale
LANG="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_CTYPE="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_ALL=

Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.

  • API (the application programming interface)
  • Build (the build process or something prior to compiled code)
  • CLI (the command line wallet)
  • Deployment (the deployment process after building such as Docker, Travis, etc.)
  • DEX (the Decentralized EXchange, market engine, etc.)
  • P2P (the peer-to-peer network for transaction/block propagation)
  • Performance (system or user efficiency, etc.)
  • Protocol (the blockchain logic, consensus, validation, etc.)
  • Security (the security of system or user data, etc.)
  • UX (the User Experience)
  • Other (please add below)

Host Environment

  • Host OS: macOS 10.13.6
  • Host Physical RAM: 16 GB
  • BitShares Version: 2.0.171025-minor-fix-1-1293-g0e86ff5 NOTE: I think this string is broken for a while
  • OpenSSL Version: 1.1.1-dev it is using a self compiled version, I even forgot when I compiled it, but seems running fine
  • Boost Version: 1.67.0

CORE TEAM TASK LIST

  • Evaluate / Prioritize Bug Report
  • Refine User Stories / Requirements
  • Define Test Cases
  • Design / Develop Solution
  • Perform QA/Testing
  • Update Documentation
@abitmore
Copy link
Member

The user doesn't have en_US.UTF8 locale installed, while the test case is trying to use it. The failing test case is:

// locales issue
std::locale loc1("en_US.UTF8");
static const std::locale& loc2 = std::locale::classic();
const wchar_t c = L'\u042f';
// isalpha will allow non ascii chars if locale is not C
BOOST_CHECK_EQUAL( isalpha(c, loc1), true);
BOOST_CHECK_EQUAL( isalpha(c, loc2), false);

@abitmore
Copy link
Member

Update: got same error in Windows.

@HarukaMa
Copy link
Contributor Author

en_US.UTF-8 may work on macos, but not sure on windows.

@jmjatlanta
Copy link
Contributor

I may be jumping in the middle here, but it is my understanding that this is testing to see if the isalpha function works as expected in various locales (new "non-C" way vs the classic "C" way).

What I do not understand is why are we testing a standard library function? Is there a belief that the standard will change? Or perhaps that some platforms will not implement it correctly?

Perhaps this test was simply to clarify how things work.

I may be wrong, but I do not see the benefit of those lines in this test. If everyone agrees, I will remove those lines. If not, please let me know why these lines are here. Thanks!

@pmconrad
Copy link
Contributor

pmconrad commented Sep 28, 2018

IIRC the asset name validation code used the system locale and thus might have allowed to create assets with non-ascii names, depending on witness system locale settings. This has been fixed, so IMO these lines can be removed.
Or perhaps replace with a test case that ensures that non-ascii asset names don't work.

@pmconrad
Copy link
Contributor

Resolved via #1346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants