Skip to content

Get tests working#2

Merged
rouson merged 3 commits intorouson:assert-3.0.0from
certik:fix-test
Jun 19, 2025
Merged

Get tests working#2
rouson merged 3 commits intorouson:assert-3.0.0from
certik:fix-test

Conversation

@certik
Copy link

@certik certik commented Jun 19, 2025

With lfortran/lfortran#7808 and this PR, the assert library now compiles and tests run:

(fpm) ~/repos/assert(fix-test)$ fpm build --compiler=lfortran --flag "--cpp" --verbose
 + mkdir -p build/dependencies
 <INFO> BUILD_NAME: build/lfortran
 <INFO> COMPILER:  lfortran
 <INFO> C COMPILER:  cc
 <INFO> CXX COMPILER: cc
 <INFO> COMPILER OPTIONS:   --cpp
 <INFO> C COMPILER OPTIONS:
 <INFO> CXX COMPILER OPTIONS:
 <INFO> LINKER OPTIONS:
 <INFO> INCLUDE DIRECTORIES:  [././include]
 + mkdir -p build/lfortran_DD9E02EB65F839BA
 + mkdir -p build/lfortran_73DB93E530B7A2CC
[  0%]        assert_subroutine_m.F90
 + mkdir -p build/lfortran_DD9E02EB65F839BA/assert/
 + lfortran -c ././src/assert/assert_subroutine_m.F90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/src_assert_assert_subroutine_m.F90.o
[ 10%]        assert_subroutine_m.F90  done.
[ 10%] fortran_stringify_integer_m.f9
 + lfortran -c ././src/assert/fortran_stringify_integer_m.f90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/src_assert_fortran_stringify_integer_m.f90.o
[ 20%] fortran_stringify_integer_m.f9  done.
[ 20%]                   assert_m.f90
 + lfortran -c ././src/assert_m.f90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/src_assert_m.f90.o
[ 30%]                   assert_m.f90  done.
[ 30%]                    libassert.a
 + ar -rs build/lfortran_DD9E02EB65F839BA/assert/libassert.a build/lfortran_DD9E02EB65F839BA/assert/src_assert_m.f90.o build/lfortran_DD9E02EB65F839BA/assert/src_assert_assert_subroutine_m.F90.o build/lfortran_DD9E02EB65F839BA/assert/src_assert_fortran_stringify_integer_m.f90.o
ar: creating archive build/lfortran_DD9E02EB65F839BA/assert/libassert.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: build/lfortran_DD9E02EB65F839BA/assert/libassert.a the table of contents is empty (no object file members in the library define global symbols)
[ 40%]                    libassert.a  done.
[ 40%]          simple-assertions.f90
 + lfortran -c example/simple-assertions.f90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/example_simple-assertions.f90.o
[ 50%]          simple-assertions.f90  done.
[ 50%]           invoke-via-macro.F90
 + lfortran -c example/invoke-via-macro.F90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/example_invoke-via-macro.F90.o
[ 60%]           invoke-via-macro.F90  done.
[ 60%]            false-assertion.F90
 + lfortran -c example/false-assertion.F90   --cpp -I././include -J build/lfortran_DD9E02EB65F839BA -Ibuild/lfortran_DD9E02EB65F839BA -o build/lfortran_DD9E02EB65F839BA/assert/example_false-assertion.F90.o
[ 70%]            false-assertion.F90  done.
[ 70%]              simple-assertions
 + mkdir -p build/lfortran_73DB93E530B7A2CC/example/
 + lfortran    --cpp -I././include  build/lfortran_DD9E02EB65F839BA/assert/example_simple-assertions.f90.o  build/lfortran_DD9E02EB65F839BA/assert/libassert.a -o build/lfortran_73DB93E530B7A2CC/example/simple-assertions
[ 80%]              simple-assertions  done.
[ 80%]               invoke-via-macro
 + lfortran    --cpp -I././include  build/lfortran_DD9E02EB65F839BA/assert/example_invoke-via-macro.F90.o  build/lfortran_DD9E02EB65F839BA/assert/libassert.a -o build/lfortran_73DB93E530B7A2CC/example/invoke-via-macro
[ 90%]               invoke-via-macro  done.
[ 90%]                false-assertion
 + lfortran    --cpp -I././include  build/lfortran_DD9E02EB65F839BA/assert/example_false-assertion.F90.o  build/lfortran_DD9E02EB65F839BA/assert/libassert.a -o build/lfortran_73DB93E530B7A2CC/example/false-assertion
[100%]                false-assertion  done.
[100%] Project compiled successfully.
(fpm) ~/repos/assert(fix-test)$ fpm test --compiler=lfortran --flag "--cpp"
test-assert-subroutine-normal-terminatidone.
test-assert-macro.F90                  done.
test-assert-subroutine-error-terminatiodone.
test-assert-subroutine-normal-terminatidone.
test-assert-macro                      done.
test-assert-subroutine-error-terminatiodone.
[100%] Project compiled successfully.

The assert subroutine
  passes on not error-terminating when assertion=.true.

The call_assert macro
  passes on not error-terminating when an assertion expression evaluating to .true. is the only argument
  passes on being removed by the preprocessor when ASSERTIONS is undefined

The call_assert_describe macro
  passes on not error-terminating when assertion = .true. and a description is present
  passes on being removed by the preprocessor when ASSERTIONS is undefined

The call_assert_* macros
  pass on invocation from a pure function

The assert subroutine
passes on error-terminating when assertion = .false.

! read(unit,*) exit_status
print *,trim(merge("passes","FAILS ",exit_status/=0)) // " on error-terminating when assertion = .false."
close(unit)
! close(unit)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround works because exit_status is already logged while doing the call execute_command_line(...).

@rouson rouson mentioned this pull request Jun 19, 2025
@rouson rouson merged commit 535434d into rouson:assert-3.0.0 Jun 19, 2025
11 of 15 checks passed
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.

3 participants