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 suite fails on s390x (big endian systems) #11

Closed
big-r81 opened this issue Jan 18, 2024 · 1 comment · Fixed by #12
Closed

Test suite fails on s390x (big endian systems) #11

big-r81 opened this issue Jan 18, 2024 · 1 comment · Fixed by #12

Comments

@big-r81
Copy link
Contributor

big-r81 commented Jan 18, 2024

Hi,

while we are trying to enable our CI worker on s390x again, we noticed some failing tests in conjunction with fast_pbkdf2. We suspect that it has something to do with the byte order.

I started two simple tests:

  1. Trying the compile fast_pbkdf2 on my local machine:
$ lscpu | grep Endian
Byte Order:                         Little Endian
$ uname -a
Darwin xxx 22.6.0 Darwin Kernel Version 22.6.0: Tue Nov  7 21:48:06 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_X86_64 x86_64
$ rebar3 as test ct
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling fast_pbkdf2
===> Running Common Test suites...
%%% pbkdf2_SUITE: ................
All 16 tests passed.
  1. Trying the compile fast_pbkdf2 on s390x:
$ lscpu | grep Endian
Byte Order:                         Big Endian
$ uname -a
Linux xxx 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:16 UTC 2023 s390x s390x s390x GNU/Linux
$ ../rebar3/rebar3 as test ct
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling fast_pbkdf2
===> Running Common Test suites...
%%% pbkdf2_SUITE: 
%%% pbkdf2_SUITE ==> equivalents.erlang_and_nif_are_equivalent_sha1: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: unknown assert: [{module,pbkdf2_SUITE},
                                {line,126},
                                {expression,
                                    "proper : quickcheck ( Prop , [ verbose , long_result , { numtests , 100 } , { start_size , 2 } , { max_size , 64 } ] )"},
                                {expected,true},
                                {not_boolean,[{<<>>,<<>>,2}]}]

%%% pbkdf2_SUITE ==> equivalents.erlang_and_nif_are_equivalent_sha384: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: unknown assert: [{module,pbkdf2_SUITE},
                                {line,126},
                                {expression,
                                    "proper : quickcheck ( Prop , [ verbose , long_result , { numtests , 100 } , { start_size , 2 } , { max_size , 64 } ] )"},
                                {expected,true},
                                {not_boolean,[{<<>>,<<>>,2}]}]

%%% pbkdf2_SUITE ==> equivalents.erlang_and_nif_are_equivalent_sha224: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: unknown assert: [{module,pbkdf2_SUITE},
                                {line,126},
                                {expression,
                                    "proper : quickcheck ( Prop , [ verbose , long_result , { numtests , 100 } , { start_size , 2 } , { max_size , 64 } ] )"},
                                {expected,true},
                                {not_boolean,[{<<>>,<<>>,2}]}]

%%% pbkdf2_SUITE ==> equivalents.erlang_and_nif_are_equivalent_sha512: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: unknown assert: [{module,pbkdf2_SUITE},
                                {line,126},
                                {expression,
                                    "proper : quickcheck ( Prop , [ verbose , long_result , { numtests , 100 } , { start_size , 2 } , { max_size , 64 } ] )"},
                                {expected,true},
                                {not_boolean,[{<<>>,<<>>,2}]}]

%%% pbkdf2_SUITE ==> equivalents.erlang_and_nif_are_equivalent_sha256: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: unknown assert: [{module,pbkdf2_SUITE},
                                {line,126},
                                {expression,
                                    "proper : quickcheck ( Prop , [ verbose , long_result , { numtests , 100 } , { start_size , 2 } , { max_size , 64 } ] )"},
                                {expected,true},
                                {not_boolean,[{<<>>,<<>>,2}]}]

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha1_1: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<12,96,200,15,150,31,14,113,243,169,181,36,175,96,18,6,47,224,55,166>>, fast_pbkdf2 : pbkdf2 ( sha , P , S , It , DkLen ))
  expected: <<12,96,200,15,150,31,14,113,243,169,181,36,175,96,18,6,47,224,55,
              166>>
       got: <<243,95,190,74,174,101,251,198,244,61,240,30,107,182,200,111,159,
              117,219,116>>
      line: 134

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha1_3: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<75,0,121,1,183,101,72,154,190,173,73,217,38,247,33,208,101,164,41,193>>, fast_pbkdf2 : pbkdf2 ( sha , P , S , It , DkLen ))
  expected: <<75,0,121,1,183,101,72,154,190,173,73,217,38,247,33,208,101,164,
              41,193>>
       got: <<139,51,238,71,200,205,114,13,243,25,249,251,52,24,34,207,37,160,
              178,192>>
      line: 144

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_6: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<137,182,157,5,22,248,41,137,60,105,98,38,101,10,134,135>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<137,182,157,5,22,248,41,137,60,105,98,38,101,10,134,135>>
       got: <<18,150,79,140,27,79,150,163,157,150,99,29,124,58,129,161>>
      line: 186

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha1_2: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<234,108,1,77,199,45,111,140,205,30,217,42,206,29,65,240,216,222,137,87>>, fast_pbkdf2 : pbkdf2 ( sha , P , S , It , DkLen ))
  expected: <<234,108,1,77,199,45,111,140,205,30,217,42,206,29,65,240,216,222,
              137,87>>
       got: <<162,142,147,226,70,125,71,2,41,186,218,118,121,85,97,119,219,100,
              62,10>>
      line: 139

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_1: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<18,15,182,207,252,248,179,44,67,231,34,82,86,196,248,55,168,101,72,201,44,204,53,72,8,5,152,124,183,11,225,123>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<18,15,182,207,252,248,179,44,67,231,34,82,86,196,248,55,168,101,
              72,201,44,204,53,72,8,5,152,124,183,11,225,123>>
       got: <<100,185,136,163,90,153,219,90,169,78,253,203,43,193,6,46,97,17,
              51,149,176,93,168,27,130,57,170,46,62,99,69,3>>
      line: 161

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_3: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<197,228,120,213,146,136,200,65,170,83,13,182,132,92,76,141,150,40,147,160,1,206,78,17,164,150,56,115,170,152,19,74>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<197,228,120,213,146,136,200,65,170,83,13,182,132,92,76,141,150,
              40,147,160,1,206,78,17,164,150,56,115,170,152,19,74>>
       got: <<5,216,128,111,219,67,200,208,44,117,146,40,26,137,192,253,106,
              210,206,153,254,147,234,168,3,139,11,63,75,168,128,81>>
      line: 171

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_2: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<174,77,12,149,175,107,70,211,45,10,223,249,40,240,109,208,42,48,63,142,243,194,81,223,214,226,216,90,149,71,76,67>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<174,77,12,149,175,107,70,211,45,10,223,249,40,240,109,208,42,48,
              63,142,243,194,81,223,214,226,216,90,149,71,76,67>>
       got: <<18,152,232,230,1,93,142,184,58,109,120,66,21,1,195,60,151,240,85,
              114,17,240,13,130,227,166,249,0,159,34,134,205>>
      line: 166

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha1_5: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<61,46,236,79,228,28,132,155,128,200,216,54,98,192,228,74,139,41,26,150,76,242,240,112,56>>, fast_pbkdf2 : pbkdf2 ( sha , P , S , It , DkLen ))
  expected: <<61,46,236,79,228,28,132,155,128,200,216,54,98,192,228,74,139,41,
              26,150,76,242,240,112,56>>
       got: <<246,9,69,235,107,64,206,108,160,98,244,154,4,76,79,162,120,140,
              211,234,25,57,147,155,143>>
      line: 154

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_5: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<52,140,137,219,203,211,43,47,50,216,20,184,17,110,132,207,43,23,52,126,188,24,0,24,28,78,42,31,184,221,83,225,198,53,81,140,125,172,71,233>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<52,140,137,219,203,211,43,47,50,216,20,184,17,110,132,207,43,23,
              52,126,188,24,0,24,28,78,42,31,184,221,83,225,198,53,81,140,125,
              172,71,233>>
       got: <<4,130,10,80,205,76,80,189,68,143,182,48,6,42,245,245,134,2,240,
              36,115,94,198,2,236,230,232,66,104,72,2,13,213,94,192,213,51,56,
              141,54>>
      line: 181

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha256_4: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<207,129,198,111,232,207,192,77,31,49,236,182,93,171,64,137,247,241,121,232,155,59,11,203,23,173,16,227,172,110,186,70>>, fast_pbkdf2 : pbkdf2 ( sha256 , P , S , It , DkLen ))
  expected: <<207,129,198,111,232,207,192,77,31,49,236,182,93,171,64,137,247,
              241,121,232,155,59,11,203,23,173,16,227,172,110,186,70>>
       got: <<218,106,153,224,27,216,175,47,84,232,82,128,182,10,82,186,19,131,
              242,181,8,110,56,107,108,38,118,217,55,147,166,154>>
      line: 176

%%% pbkdf2_SUITE ==> test_vectors.test_vector_sha1_4: FAILED
%%% pbkdf2_SUITE ==> 
Failure/Error: ?assertEqual(<<238,254,61,97,205,77,164,228,233,148,91,61,107,162,21,140,38,52,233,132>>, fast_pbkdf2 : pbkdf2 ( sha , P , S , It , DkLen ))
  expected: <<238,254,61,97,205,77,164,228,233,148,91,61,107,162,21,140,38,52,
              233,132>>
       got: <<132,159,125,6,127,79,84,233,173,135,116,135,85,247,117,210,47,
              158,203,80>>
      line: 149

EXPERIMENTAL: Writing retry specification at /home/linux1/fast_pbkdf2/_build/test/logs/retry.spec
              call rebar3 ct with '--retry' to re-run failing cases.
Failed 16 tests. Passed 0 tests. 
Results written to "/home/linux1/fast_pbkdf2/_build/test/logs/index.html".
===> Failures occurred running tests: 16

Little-endian sytems do not appear to be affected.

Cheers,
Ronny

@namrata-ibm
Copy link
Contributor

namrata-ibm commented Jan 18, 2024

Hi @big-r81 , indeed the issue is due to Byte Order. I could reproduce the failures locally on an s390x system. I also have a fix ready by changing the Byte order and can PR those changes soon.

big-r81 added a commit to big-r81/fast_pbkdf2 that referenced this issue Jan 19, 2024
Give a warning for undefined macros to prevent errors like esl#11.
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

Successfully merging a pull request may close this issue.

2 participants