Skip to content

Update test scripts to be posix compliant#511

Open
ColemanTom wants to merge 1 commit intoNOAA-EMC:developfrom
ColemanTom:make_tests_posix
Open

Update test scripts to be posix compliant#511
ColemanTom wants to merge 1 commit intoNOAA-EMC:developfrom
ColemanTom:make_tests_posix

Conversation

@ColemanTom
Copy link
Copy Markdown

I've made some changes to the test scripts to make them shell compliant (or more modern shell). I am making this as it was found building this on OSX led to failures for run_ipolates_tests.sh.

The majority are simple things like

  • Change ` ... ` to $(....)
  • Change [[ ... to [ ...

The bigger changes are to run_gmerge_tests.sh and run_ipolates_tests.sh

run_gmerge_tests.sh

If running as zsh, there is a risk that word splitting won't work properly, so I've redefined args to be using the positional array @, and use that everywhere. It's the only way I know of which suppoprts all shells.

run_ipolates_tests.sh

The named output pipe is BASH specific. I've chanegd to a series of three numbered redirects which gives the same result in this case.

Testing

Before this change, if I change bash to zsh in the ctest setup, run_ipolates_tests.sh fails due to the named pipe. Its not posix compliant, but if running as zsh, it fails too as its not a zsh thing. The [[ didn't cause issues as they are in most shells anyway.

Test project /home/tcoleman/code/wgrib2-feedstock/wgrib2-3.8.0/bld
      Start  1: run_wgrib2_tests.sh
 1/15 Test  #1: run_wgrib2_tests.sh ................   Passed    2.33 sec
      Start  2: run_wgrib2_rpn_tests.sh
 2/15 Test  #2: run_wgrib2_rpn_tests.sh ............   Passed    0.82 sec
      Start  3: run_wgrib2_update_table_tests.sh
 3/15 Test  #3: run_wgrib2_update_table_tests.sh ...   Passed    0.05 sec
      Start  4: run_wgrib2_png_tests.sh
 4/15 Test  #4: run_wgrib2_png_tests.sh ............   Passed    0.74 sec
      Start  5: run_gmerge_tests.sh
 5/15 Test  #5: run_gmerge_tests.sh ................***Failed    0.30 sec
      Start  6: run_wgrib2_netcdf4_tests.sh
 6/15 Test  #6: run_wgrib2_netcdf4_tests.sh ........   Passed    1.25 sec
      Start  7: run_wgrib2_netcdf3_tests.sh
 7/15 Test  #7: run_wgrib2_netcdf3_tests.sh ........   Passed    0.28 sec
      Start  8: run_wgrib_tests.sh
 8/15 Test  #8: run_wgrib_tests.sh .................   Passed    0.02 sec
      Start  9: run_ipolates_tests.sh
 9/15 Test  #9: run_ipolates_tests.sh ..............***Failed    2.71 sec
      Start 10: run_wgrib2_aec_tests.sh
10/15 Test #10: run_wgrib2_aec_tests.sh ............   Passed    0.94 sec
      Start 11: run_jpeg_tests.sh
11/15 Test #11: run_jpeg_tests.sh ..................   Passed   12.13 sec
      Start 12: test_fortran_api
12/15 Test #12: test_fortran_api ...................   Passed    0.13 sec
      Start 13: test_lib.sh
13/15 Test #13: test_lib.sh ........................   Passed    0.00 sec
      Start 14: test_c_api
14/15 Test #14: test_c_api .........................   Passed    0.13 sec
      Start 15: test_shared_lib.sh
15/15 Test #15: test_shared_lib.sh .................   Passed    0.00 sec

87% tests passed, 2 tests failed out of 15

Total Test time (real) =  21.87 sec

The following tests FAILED:
	  5 - run_gmerge_tests.sh (Failed)
	  9 - run_ipolates_tests.sh (Failed)
Errors while running CTest

Apparently forcing to zsh can also lead to failures in the gmerge tests which I had not seen before.

After I make this change, whilst forcing to run as zsh, all tests pass

Test project /home/tcoleman/code/wgrib2/bld
      Start  1: run_wgrib2_tests.sh
 1/26 Test  #1: run_wgrib2_tests.sh ................   Passed    4.30 sec
      Start  2: run_wgrib2_rpn_tests.sh
 2/26 Test  #2: run_wgrib2_rpn_tests.sh ............   Passed    0.98 sec
      Start  3: run_wgrib2_update_table_tests.sh
 3/26 Test  #3: run_wgrib2_update_table_tests.sh ...   Passed    0.05 sec
      Start  4: run_wgrib2_png_tests.sh
 4/26 Test  #4: run_wgrib2_png_tests.sh ............   Passed    0.71 sec
      Start  5: run_gmerge_tests.sh
 5/26 Test  #5: run_gmerge_tests.sh ................   Passed   95.43 sec
      Start  6: run_wgrib2_netcdf4_tests.sh
 6/26 Test  #6: run_wgrib2_netcdf4_tests.sh ........   Passed    1.57 sec
      Start  7: run_wgrib2_netcdf3_tests.sh
 7/26 Test  #7: run_wgrib2_netcdf3_tests.sh ........   Passed    0.40 sec
      Start  8: run_wgrib_tests.sh
 8/26 Test  #8: run_wgrib_tests.sh .................   Passed    0.03 sec
      Start  9: run_ipolates_tests.sh
 9/26 Test  #9: run_ipolates_tests.sh ..............   Passed   23.83 sec
      Start 10: run_wgrib2_aec_tests.sh
10/26 Test #10: run_wgrib2_aec_tests.sh ............   Passed    1.59 sec
      Start 11: run_jpeg_tests.sh
11/26 Test #11: run_jpeg_tests.sh ..................   Passed   12.67 sec
      Start 12: test_uint8_64bit
12/26 Test #12: test_uint8_64bit ...................   Passed    0.01 sec
      Start 13: test_uint8_32bit
13/26 Test #13: test_uint8_32bit ...................   Passed    0.01 sec
      Start 14: test_rd_msg
14/26 Test #14: test_rd_msg ........................   Passed    0.03 sec
      Start 15: test_fortran_api
15/26 Test #15: test_fortran_api ...................   Passed    0.13 sec
      Start 16: test_lib.sh
16/26 Test #16: test_lib.sh ........................   Passed    0.00 sec
      Start 17: test_c_api
17/26 Test #17: test_c_api .........................   Passed    0.13 sec
      Start 18: test_string2time_unit
18/26 Test #18: test_string2time_unit ..............   Passed    0.01 sec
      Start 19: test_read_latlon
19/26 Test #19: test_read_latlon ...................   Passed    0.02 sec
      Start 20: test_pdt_len
20/26 Test #20: test_pdt_len .......................   Passed    0.02 sec
      Start 21: test_addtime
21/26 Test #21: test_addtime .......................   Passed    0.02 sec
      Start 22: test_flt2ieee
22/26 Test #22: test_flt2ieee ......................   Passed    0.03 sec
      Start 23: test_units
23/26 Test #23: test_units .........................   Passed    0.02 sec
      Start 24: test_update_sec
24/26 Test #24: test_update_sec ....................   Passed    0.02 sec
      Start 25: test_subtime
25/26 Test #25: test_subtime .......................   Passed    0.03 sec
      Start 26: test_shared_lib.sh
26/26 Test #26: test_shared_lib.sh .................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 26

Total Test time (real) = 142.06 sec

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 this pull request may close these issues.

1 participant