From: <mat...@us...> - 2010-04-06 11:59:50
|
Revision: 3137 http://rapideuphoria.svn.sourceforge.net/rapideuphoria/?rev=3137&view=rev Author: mattlewis Date: 2010-04-06 11:59:44 +0000 (Tue, 06 Apr 2010) Log Message: ----------- * fixed safe.e tests to pass on non-Windows platforms Modified Paths: -------------- trunk/tests/t_c_safe_c_func_nodep.e trunk/tests/t_safe.e Modified: trunk/tests/t_c_safe_c_func_nodep.e =================================================================== --- trunk/tests/t_c_safe_c_func_nodep.e 2010-04-06 09:40:59 UTC (rev 3136) +++ trunk/tests/t_c_safe_c_func_nodep.e 2010-04-06 11:59:44 UTC (rev 3137) @@ -1,5 +1,6 @@ + +ifdef WINDOWS then with define SAFE - include std/unittest.e include std/machine.e include std/dll.e @@ -20,3 +21,11 @@ test_pass("Should not be able to define a c function in non-executable memory") +elsedef + +-- this test is Windows only, so it won't break on *nix. Since it +-- has a control.err file, we'll just fake it. +include std/filesys.e +copy_file( "t_c_safe_c_func_nodep.d/control.err", "ex.err", 1 ) +abort(1) +end ifdef Modified: trunk/tests/t_safe.e =================================================================== --- trunk/tests/t_safe.e 2010-04-06 09:40:59 UTC (rev 3136) +++ trunk/tests/t_safe.e 2010-04-06 11:59:44 UTC (rev 3137) @@ -4,6 +4,7 @@ include std/safe.e include std/unittest.e + edges_only = 0 std_library_address addr @@ -12,9 +13,15 @@ if addr != 0 then test_pass("PAGE_NONE memory was allocated by allocate_protect") - test_false("PAGE_NONE memory readable", safe_address(addr, 4, A_READ)) - test_false("PAGE_NONE memory writable", safe_address(addr, 4, A_WRITE)) - test_false("PAGE_NONE memory executable", safe_address( addr, 4, A_EXECUTE )) + ifdef WINDOWS then + test_false("PAGE_NONE memory readable", safe_address(addr, 4, A_READ)) + test_false("PAGE_NONE memory writable", safe_address(addr, 4, A_WRITE)) + test_false("PAGE_NONE memory executable", safe_address( addr, 4, A_EXECUTE )) + elsedef + test_true("PAGE_NONE memory readable", safe_address(addr, 4, A_READ)) + test_true("PAGE_NONE memory writable", safe_address(addr, 4, A_WRITE)) + test_true("PAGE_NONE memory executable", safe_address( addr, 4, A_EXECUTE )) + end ifdef safe:free_code(addr, 4) else test_fail("PAGE_NONE memory could not be allocated by allocate_protect") @@ -25,8 +32,13 @@ if addr != 0 then test_pass("PAGE_READ memory was allocated by allocate_protect") test_true("PAGE_READ memory readable", safe_address(addr, 4, A_READ)) - test_false("PAGE_READ memory writable", safe_address(addr, 4, A_WRITE)) - test_false("PAGE_READ memory executable", safe_address( addr, 4, A_EXECUTE )) + ifdef WINDOWS then + test_false("PAGE_READ memory writable", safe_address(addr, 4, A_WRITE)) + test_false("PAGE_READ memory executable", safe_address( addr, 4, A_EXECUTE )) + elsedef + test_true("PAGE_READ memory writable", safe_address(addr, 4, A_WRITE)) + test_true("PAGE_READ memory executable", safe_address( addr, 4, A_EXECUTE )) + end ifdef else test_fail("PAGE_READ memory could not be allocated by allocate_protect") end if @@ -37,7 +49,11 @@ test_pass("PAGE_READ_WRITE memory was allocated by allocate_protect") test_true("PAGE_READ_WRITE memory readable", safe_address(addr, 4, A_READ)) test_true("PAGE_READ_WRITE memory writable", safe_address(addr, 4, A_WRITE)) - test_false("PAGE_READ_WRITE memory executable", safe_address( addr, 4, A_EXECUTE )) + ifdef WINDOWS then + test_false("PAGE_READ_WRITE memory executable", safe_address( addr, 4, A_EXECUTE )) + elsedef + test_true("PAGE_READ_WRITE memory executable", safe_address( addr, 4, A_EXECUTE )) + end ifdef else test_fail("PAGE_READ_WRITE memory could not be allocated by allocate_protect") end if @@ -58,7 +74,11 @@ if addr != 0 then test_pass("PAGE_READ_EXECUTE memory was allocated by allocate_protect") test_true("PAGE_READ_EXECUTE memory readable", safe_address(addr, 4, A_READ)) - test_false("PAGE_READ_EXECUTE memory writable", safe_address(addr, 4, A_WRITE)) + ifdef WINDOWS then + test_false("PAGE_READ_EXECUTE memory writable", safe_address(addr, 4, A_WRITE)) + elsedef + test_true("PAGE_READ_EXECUTE memory writable", safe_address(addr, 4, A_WRITE)) + end ifdef test_true("PAGE_READ_EXECUTE memory executable", safe_address( addr, 4, A_EXECUTE )) else test_fail("PAGE_READ_EXECUTE memory could not be allocated by allocate_protect") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |