Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testament now checks OS, CPU, endianess, bitsizes 8-64 in discard statements #19137

Merged
merged 2 commits into from
Nov 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions testament/specs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import sequtils, parseutils, strutils, os, streams, parsecfg,
tables, hashes, sets
import compiler/platform

type TestamentData* = ref object
# better to group globals under 1 object; could group the other ones here too
Expand Down Expand Up @@ -329,7 +330,8 @@ proc parseSpec*(filename: string): TSpec =
# Valgrind only supports OSX <= 17.x
result.useValgrind = disabled
of "disabled":
case e.value.normalize
let value = e.value.normalize
case value
of "y", "yes", "true", "1", "on": result.err = reDisabled
of "n", "no", "false", "0", "off": discard
of "win", "windows":
Expand Down Expand Up @@ -364,7 +366,18 @@ proc parseSpec*(filename: string): TSpec =
of "netbsd":
when defined(netbsd): result.err = reDisabled
else:
result.parseErrors.addLine "cannot interpret as a bool: ", e.value
block checkHost:
for os in platform.OS:
if value == os.name.normalize:
if value == hostOS.normalize:
quantimnot marked this conversation as resolved.
Show resolved Hide resolved
result.err = reDisabled
break checkHost
for cpu in platform.CPU:
if value == cpu.name.normalize:
if value == hostCPU.normalize:
result.err = reDisabled
break checkHost
result.parseErrors.addLine "cannot interpret as a bool: ", e.value
of "cmd":
if e.value.startsWith("nim "):
result.cmd = compilerPrefix & e.value[3..^1]
Expand Down