diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f204964f88..28ef711ec8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,8 +10,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04] - gcc_v: [7,8,9,10] # Version of GFortran we want to use. - python-version: [3.9] + gcc_v: [7,8,9,10,11] # Version of GFortran we want to use. + python-version: [3.11] env: FC: gfortran-${{matrix.gcc_v}} GCC_V: ${{matrix.gcc_v}} @@ -46,7 +46,7 @@ jobs: if: contains( matrix.os, 'ubuntu') run: | python -m pip install --upgrade pip - pip install ford FoBiS.py pygooglechart + pip install ford FoBiS.py pygooglechart fpm if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Install GFortran Linux @@ -60,7 +60,7 @@ jobs: --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} - name: Compile_with_build - if: matrix.gcc_v != 7 + if: matrix.gcc_v != 7 && matrix.gcc_v != 11 run: | GFORTRAN=gfortran-${{matrix.gcc_v}} GCOV=gcov-${{matrix.gcc_v}} @@ -68,6 +68,63 @@ jobs: ./build.sh --skip-documentation ./build.sh --skip-documentation --enable-unicode + - name: Compile_with_FPM + if: matrix.gcc_v == 11 + run: | + GFORTRAN=gfortran-${{matrix.gcc_v}} + GCOV=gcov-${{matrix.gcc_v}} + sudo apt update && sudo apt install -y valgrind + fpm test jf_test_01 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_02 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_03 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_04 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_05 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_06 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_07 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_08 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_09 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_10 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_11 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_12 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_13 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_14 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_15 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_16 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_17 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_18 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_19 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_20 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_21 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_22 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_23 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_24 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_25 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_26 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_27 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_28 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_29 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_30 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_31 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_32 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_33 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_34 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_35 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_36 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_37 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_38 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_39 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_40 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_41 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_42 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_43 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_44 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_45 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_46 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_47 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_48 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_49 --runner "valgrind --leak-check=full --show-leak-kinds=all" + fpm test jf_test_50 --runner "valgrind --leak-check=full --show-leak-kinds=all" + - name: Compile_with_cmake # CMake build with unit tests, no documentation, with coverage analysis # No unicode so that coverage combined with the build script will cover unicode diff --git a/src/tests/jf_test_12.F90 b/src/tests/jf_test_12.F90 index 0b708a546d..db77c71d7e 100644 --- a/src/tests/jf_test_12.F90 +++ b/src/tests/jf_test_12.F90 @@ -150,7 +150,10 @@ subroutine test_12(error_cnt) call json%get(me=root,path='array data.data',array_callback=get_3D_from_array) call check_errors(all(abs(fetched_array - reshape(raw_array,[size(raw_array)])) <= TOL)) - my_file = json_file(root,verbose=.true.,real_format='G') + !my_file = json_file(root,verbose=.true.,real_format='G') ! valgrind says this cases a memory leak + call my_file%initialize(verbose=.true.,real_format='G') ! this doesn't have a memmory leak + call my_file%add(root) + nullify(root) call my_file%update('array data.description',CK_'vector data',found=existed) call check_file_errors(existed) diff --git a/src/tests/jf_test_15.F90 b/src/tests/jf_test_15.F90 index e53986c71f..d1991f9464 100644 --- a/src/tests/jf_test_15.F90 +++ b/src/tests/jf_test_15.F90 @@ -216,7 +216,9 @@ subroutine test_15(error_cnt) !**************************************** - file1 = json_file(p2,json) !constructor + !file1 = json_file(p2,json) ! memory leak with gfortran? + call file1%initialize(json) + call file1%add(p2); nullify(p2) call file1%destroy(destroy_core=.true.) !**************************************** diff --git a/src/tests/jf_test_25.F90 b/src/tests/jf_test_25.F90 index 332ae7e4cf..468542e86a 100644 --- a/src/tests/jf_test_25.F90 +++ b/src/tests/jf_test_25.F90 @@ -108,7 +108,9 @@ subroutine test_25(error_cnt) #endif ! test json_file interface - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) nullify(p) ! data is now in f call f%get('str_array', vec, ilen, found) if (.not. found) then diff --git a/src/tests/jf_test_27.F90 b/src/tests/jf_test_27.F90 index 017ce0ece0..d612ba3d99 100644 --- a/src/tests/jf_test_27.F90 +++ b/src/tests/jf_test_27.F90 @@ -60,7 +60,9 @@ subroutine test_27(error_cnt) call json%print(p,int(output_unit,IK)) ! test json_file interface - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) nullify(p) ! data is now in f call f%initialize(compress_vectors=.true.) call f%print() diff --git a/src/tests/jf_test_37.F90 b/src/tests/jf_test_37.F90 index eaa1ffd1d5..a47fa7e547 100644 --- a/src/tests/jf_test_37.F90 +++ b/src/tests/jf_test_37.F90 @@ -39,26 +39,34 @@ subroutine test_37(error_cnt) call json%initialize(no_whitespace=.true.) call json%deserialize(p, CK_'{"a": ["1", "2", "3"]}') - f = json_file(p,no_whitespace=.true.) + !f = json_file(p,no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() call json%deserialize(p, CK_'{"b": ["4", "5", "6"]}') - f = json_file(p,json) + !f = json_file(p,json) ! memory leak in gfortran? + call f%initialize(json) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CK_'{"x": [1,2,3]}',no_whitespace=.true.) + !f = json_file(CK_'{"x": [1,2,3]}',no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%deserialize(CK_'{"x": [1,2,3]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CK_'{"y": [4,5,6]}',json) + !f = json_file(CK_'{"y": [4,5,6]}',json) ! memory leak in gfortran? + call f%initialize(json) + call f%deserialize(CK_'{"y": [4,5,6]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() @@ -69,26 +77,34 @@ subroutine test_37(error_cnt) ! also test default character kind when unicode is enabled: call json%deserialize(p, CDK_'{"a": ["1", "2", "3"]}') - f = json_file(p,no_whitespace=.true.) + !f = json_file(p,no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() call json%deserialize(p, CDK_'{"b": ["4", "5", "6"]}') - f = json_file(p,json) + !f = json_file(p,json) ! memory leak in gfortran? + call f%initialize(json) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CDK_'{"x": [1,2,3]}',no_whitespace=.true.) + !f = json_file(CDK_'{"x": [1,2,3]}',no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%deserialize(CDK_'{"x": [1,2,3]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CDK_'{"y": [4,5,6]}',json) + !f = json_file(CDK_'{"y": [4,5,6]}',json) ! memory leak in gfortran? + call f%initialize(json) + call f%deserialize(CDK_'{"y": [4,5,6]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() diff --git a/src/tests/jf_test_39.F90 b/src/tests/jf_test_39.F90 index a22cfaea9c..eeec7cf2a2 100644 --- a/src/tests/jf_test_39.F90 +++ b/src/tests/jf_test_39.F90 @@ -44,7 +44,9 @@ subroutine test_39(error_cnt) do i = 1, size(tests) - json = json_file(trim(tests(i)),verbose=.true.,stop_on_error=.true.) + !json = json_file(trim(tests(i)),verbose=.true.,stop_on_error=.true.) ! memory leak in gfortran? + call json%initialize(verbose=.true.,stop_on_error=.true.) + call json%deserialize(trim(tests(i))) call json%print(int(error_unit,IK)) write(error_unit,'(A)') '' if (json%failed()) then diff --git a/src/tests/jf_test_41.F90 b/src/tests/jf_test_41.F90 index 1fd6fc7432..8e9cf0c39e 100644 --- a/src/tests/jf_test_41.F90 +++ b/src/tests/jf_test_41.F90 @@ -57,7 +57,9 @@ subroutine test_41(error_cnt) write(error_unit,'(A)') '' write(error_unit,'(A)') 'copying to json_file...' - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) call f2%add(p2) nullify(p2) ! data is now in f diff --git a/src/tests/jf_test_46.F90 b/src/tests/jf_test_46.F90 index 558cc7f0da..92bca2e86f 100644 --- a/src/tests/jf_test_46.F90 +++ b/src/tests/jf_test_46.F90 @@ -166,7 +166,8 @@ subroutine test_46(error_cnt) ! now, json_file routines: !--------------------------------- - json_f = json_file(str) + !json_f = json_file(str) ! memory leak in gfortran? + call json_f%deserialize(str) ! unicode: call json_f%get(CK_'not_there', ival, found, default=99_IK) diff --git a/src/tests/jf_test_50.F90 b/src/tests/jf_test_50.F90 index f2742de9bb..f1b303b959 100644 --- a/src/tests/jf_test_50.F90 +++ b/src/tests/jf_test_50.F90 @@ -31,11 +31,18 @@ subroutine test_50(error_cnt) type(json_core) :: json type(json_value),pointer :: p + write(error_unit,'(A)') '' + write(error_unit,'(A)') '=================================' + write(error_unit,'(A)') ' EXAMPLE 50' + write(error_unit,'(A)') '=================================' + write(error_unit,'(A)') '' + call json%initialize(compress_vectors = .true.) ! so it will print each col on one line call json%create_object(p,'') !create the root call json_value_add_real_vec_2d(json, p, CK_'Pcir', pcir, by_col=.true.) call json%print(p) + call json%destroy(p) error_cnt = 0