Skip to content

Commit

Permalink
Update to give LD_LIBRARY_PATH when testing example
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Dec 10, 2023
1 parent 813db87 commit bb3b313
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.100_amd64.deb
sudo apt install build/meevax_0.5.101_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.100.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.101.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.100_amd64.deb`
| `package` | Generate debian package `meevax_0.5.101_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.100
0.5.101
10 changes: 7 additions & 3 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Meevax::kernel)

enable_testing()

add_test(NAME ${PROJECT_NAME}
COMMAND meevax ${PROJECT_NAME}.ss
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_test(
NAME ${PROJECT_NAME}
COMMAND meevax ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.ss)

set_property(
TEST ${PROJECT_NAME}
PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_CURRENT_BINARY_DIR}")

add_custom_target(develop COMMAND ${CMAKE_MAKE_PROGRAM}
COMMAND ${CMAKE_CTEST_COMMAND})
13 changes: 8 additions & 5 deletions example/example.ss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
(scheme write)
(srfi 78))

(display (get-environment-variable "LD_LIBRARY_PATH"))
(newline)

; ------------------------------------------------------------------------------

(define dummy-procedure
(procedure "build/libexample.so" 'dummy_procedure))
(procedure "libexample.so" 'dummy_procedure))

(check (procedure? dummy-procedure) => #t)

Expand All @@ -16,7 +19,7 @@
; ------------------------------------------------------------------------------

(define arity
(procedure "build/libexample.so" 'arity))
(procedure "libexample.so" 'arity))

(check (procedure? arity) => #t)

Expand All @@ -25,13 +28,13 @@
; ------------------------------------------------------------------------------

(define make-hoge
(procedure "build/libexample.so" 'make_hoge))
(procedure "libexample.so" 'make_hoge))

(define hoge?
(procedure "build/libexample.so" 'is_hoge))
(procedure "libexample.so" 'is_hoge))

(define hoge-value
(procedure "build/libexample.so" 'hoge_value))
(procedure "libexample.so" 'hoge_value))

(check (procedure? make-hoge) => #t)

Expand Down

0 comments on commit bb3b313

Please sign in to comment.