Make ovni.require a mandatory attribute
We no longer accept streams that don't have the ovni.require attribute.
This commit is contained in:
		
							parent
							
								
									361290e24f
								
							
						
					
					
						commit
						5c11c469f2
					
				| @ -235,13 +235,6 @@ model_finish(struct model *model, struct emu *emu) | |||||||
| static int | static int | ||||||
| should_enable(int have[3], struct model_spec *spec, struct thread *t) | should_enable(int have[3], struct model_spec *spec, struct thread *t) | ||||||
| { | { | ||||||
| 	static int compat = 0; |  | ||||||
| 
 |  | ||||||
| 	/* Enable all models if we are in compatibility model. Don't check other
 |  | ||||||
| 	 * threads metadata */ |  | ||||||
| 	if (compat) |  | ||||||
| 		return 1; |  | ||||||
| 
 |  | ||||||
| 	if (t->meta == NULL) { | 	if (t->meta == NULL) { | ||||||
| 		err("missing metadata for thread %s", t->id); | 		err("missing metadata for thread %s", t->id); | ||||||
| 		return -1; | 		return -1; | ||||||
| @ -249,12 +242,8 @@ should_enable(int have[3], struct model_spec *spec, struct thread *t) | |||||||
| 
 | 
 | ||||||
| 	JSON_Object *require = json_object_dotget_object(t->meta, "ovni.require"); | 	JSON_Object *require = json_object_dotget_object(t->meta, "ovni.require"); | ||||||
| 	if (require == NULL) { | 	if (require == NULL) { | ||||||
| 		warn("missing 'ovni.require' key in thread %s", t->id); | 		err("missing 'ovni.require' key in thread %s", t->id); | ||||||
| 		warn("loading trace in compatibility mode"); | 		return -1; | ||||||
| 		warn("all models will be enabled (expect slowdown)"); |  | ||||||
| 		warn("use ovni_thread_require() to enable only required models"); |  | ||||||
| 		compat = 1; |  | ||||||
| 		return 1; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* May not have the current model */ | 	/* May not have the current model */ | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ test_emu(sort-cpus-by-rank.c MP) | |||||||
| test_emu(tracedir-subdir.c MP DRIVER "tracedir-subdir.driver.sh") | test_emu(tracedir-subdir.c MP DRIVER "tracedir-subdir.driver.sh") | ||||||
| test_emu(empty-stream.c SHOULD_FAIL REGEX "missing ovni.finished") | test_emu(empty-stream.c SHOULD_FAIL REGEX "missing ovni.finished") | ||||||
| test_emu(require-bad-version.c SHOULD_FAIL REGEX "unsupported ovni model version (want 666.66.6, have .*)") | test_emu(require-bad-version.c SHOULD_FAIL REGEX "unsupported ovni model version (want 666.66.6, have .*)") | ||||||
| test_emu(require-compat.c REGEX "loading trace in compatibility mode") | test_emu(require-compat.c SHOULD_FAIL REGEX "missing 'ovni.require' key in thread") | ||||||
| test_emu(require-repeated.c) | test_emu(require-repeated.c) | ||||||
| test_emu(thread-crash.c SHOULD_FAIL REGEX "missing ovni.finished") | test_emu(thread-crash.c SHOULD_FAIL REGEX "missing ovni.finished") | ||||||
| test_emu(thread-free-isready.c) | test_emu(thread-free-isready.c) | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
| 
 | 
 | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| @ -35,6 +35,7 @@ main(void) | |||||||
| 	for (int i = 0; i < N; i++) | 	for (int i = 0; i < N; i++) | ||||||
| 		ovni_add_cpu(i, cpus[i]); | 		ovni_add_cpu(i, cpus[i]); | ||||||
| 
 | 
 | ||||||
|  | 	instr_require("ovni"); | ||||||
| 	instr_thread_execute(-1, -1, 0); | 	instr_thread_execute(-1, -1, 0); | ||||||
| 
 | 
 | ||||||
| 	instr_end(); | 	instr_end(); | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
| 
 | 
 | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| @ -36,6 +36,7 @@ main(void) | |||||||
| 	for (int i = 0; i < N; i++) | 	for (int i = 0; i < N; i++) | ||||||
| 		ovni_add_cpu(i, cpus[i]); | 		ovni_add_cpu(i, cpus[i]); | ||||||
| 
 | 
 | ||||||
|  | 	instr_require("ovni"); | ||||||
| 	instr_thread_execute(-1, -1, 0); | 	instr_thread_execute(-1, -1, 0); | ||||||
| 
 | 
 | ||||||
| 	instr_end(); | 	instr_end(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user