mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:12:43 +00:00 
			
		
		
		
	 cc0a376c95
			
		
	
	
		cc0a376c95
		
	
	
	
	
		
			
			This test program heavily pulls from the JavaScriptTestRunner/test-js, but with a twist. Instead of loading JavaScript files into the current process, constructing a JS environment for them, and executing test suites/tests directly, run-tests posix_spawns each test file. Test file stdout is written to a temp file, and only dumped to console if the test fails or the verbose option is passed to the program. Unlike test-js, times are always printed for every test executed for better visibility in CI.
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
 | |
|  * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
 | |
|  * Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/String.h>
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace Test {
 | |
| 
 | |
| enum class Result {
 | |
|     Pass,
 | |
|     Fail,
 | |
|     Skip,
 | |
|     Crashed,
 | |
| };
 | |
| 
 | |
| struct Case {
 | |
|     String name;
 | |
|     Result result;
 | |
|     String details;
 | |
| };
 | |
| 
 | |
| struct Suite {
 | |
|     String name;
 | |
|     // A failed test takes precedence over a skipped test, which both have
 | |
|     // precedence over a passed test
 | |
|     Result most_severe_test_result { Result::Pass };
 | |
|     Vector<Case> tests {};
 | |
| };
 | |
| 
 | |
| struct Counts {
 | |
|     // Not all of these might be used by a certain test runner, e.g. some
 | |
|     // do not have a concept of suites, or might not load tests from files.
 | |
|     unsigned tests_failed { 0 };
 | |
|     unsigned tests_passed { 0 };
 | |
|     unsigned tests_skipped { 0 };
 | |
|     unsigned suites_failed { 0 };
 | |
|     unsigned suites_passed { 0 };
 | |
|     unsigned files_total { 0 };
 | |
| };
 | |
| 
 | |
| }
 |