File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -616,6 +616,19 @@ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}cliffi_test${CMA
616616set_tests_properties (repl_smoketest PROPERTIES PASS_REGULAR_EXPRESSION "Function returned: 3" )
617617set_tests_properties (repl_smoketest PROPERTIES PASS_REGULAR_EXPRESSION "Function returned: 7" )
618618
619+ add_test (NAME repl_metatest_tests_fail_on_bad_input
620+ COMMAND cliffi --repltest
621+ thisisnotagoodcommand \n
622+ should_not_reach_here = 1 \n
623+ )
624+ set_tests_properties (repl_metatest_tests_fail_on_bad_input PROPERTIES WILL_FAIL TRUE ) # this test is expected to fail
625+
626+ add_test (NAME repl_metatest_tests_fail_on_segfault
627+ COMMAND cliffi --repltest
628+ null_pointer = -P 0 \n
629+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /${CMAKE_SHARED_LIBRARY_PREFIX} cliffi_test${CMAKE_SHARED_LIBRARY_SUFFIX} i increment_at_pointer null_pointer \n
630+ )
631+ set_tests_properties (repl_metatest_tests_fail_on_segfault PROPERTIES WILL_FAIL TRUE ) # this test is expected to fail
619632
620633add_test (NAME repl_test_globals #
621634COMMAND cliffi --repltest
Original file line number Diff line number Diff line change @@ -26,12 +26,9 @@ double multiply(double a, double b) {
2626}
2727
2828// A function that takes a pointer to an integer, increments it, and returns the result
29- int increment_at_pointer (int * a ) {
30- if (a ) {
31- (* a )++ ;
32- return * a ;
33- }
34- return 0 ;
29+ int increment_at_pointer (int * a ) { //deliberately unsafe
30+ (* a )++ ;
31+ return * a ;
3532}
3633
3734int * get_array_of_int (int a , size_t size ) {
You can’t perform that action at this time.
0 commit comments