mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
Tests+Base: Convert stack-smash to be LibTest based and stop skipping it
Now that the test is converted to be LibTest based, we can remove it from the exclude list in /home/anon/.config/Tests.ini. Prior to this it would crash and fail because it was signaled instead of returning normally with exit code 0.
This commit is contained in:
parent
f0d562131f
commit
d0447f23b8
3 changed files with 11 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
[Global]
|
[Global]
|
||||||
SkipDirectories=Kernel/Legacy UserEmulator
|
SkipDirectories=Kernel/Legacy UserEmulator
|
||||||
SkipTests=stack-smash test-web
|
SkipTests=test-web
|
||||||
NotTestsPattern=.txt|.frm|.inc
|
NotTestsPattern=.txt|.frm|.inc
|
||||||
|
|
||||||
[test-js]
|
[test-js]
|
||||||
|
|
|
@ -7,6 +7,7 @@ set(TEST_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCDirEnt.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCDirEnt.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCInodeWatcher.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCInodeWatcher.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCString.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/TestLibCString.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/TestStackSmash.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB CMD_SOURCES CONFIGURE_DEPENDS "*.cpp")
|
file(GLOB CMD_SOURCES CONFIGURE_DEPENDS "*.cpp")
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdio>
|
#include <AK/Format.h>
|
||||||
|
#include <LibTest/TestCase.h>
|
||||||
|
|
||||||
// Note: Needs to be 'noline' so stack canary isn't optimized out.
|
// Note: Needs to be 'noline' so stack canary isn't optimized out.
|
||||||
static void __attribute__((noinline)) smasher(char* string)
|
static void __attribute__((noinline)) smasher(char* string)
|
||||||
|
@ -24,11 +25,12 @@ static void __attribute__((noinline)) stack_to_smash()
|
||||||
smasher(string);
|
smasher(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
TEST_CASE(stack_smash)
|
||||||
{
|
{
|
||||||
puts("[+] Starting the stack smash...");
|
EXPECT_CRASH("Smash the stack and trigger __stack_chk_fail", [] {
|
||||||
stack_to_smash();
|
outln("[+] Starting the stack smash...");
|
||||||
puts("[+] Stack smash wasn't detected!");
|
stack_to_smash();
|
||||||
|
outln("[+] Stack smash wasn't detected!");
|
||||||
return 0;
|
return Test::Crash::Failure::DidNotCrash;
|
||||||
|
});
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue