Make it possible to turn off loading of profile.carp, useful for

tests (especially the --no-core one).
This commit is contained in:
Erik Svedäng 2020-04-30 15:01:30 +02:00
parent 504f63ffb4
commit 1eaebb7d33
4 changed files with 25 additions and 4 deletions

View File

@ -55,6 +55,7 @@ main = do setLocaleEncoding utf8
let (argFilesToLoad, execMode, otherOptions) = parseArgs args
logMemory = LogMemory `elem` otherOptions
noCore = NoCore `elem` otherOptions
noProfile = NoProfile `elem` otherOptions
optimize = Optimize `elem` otherOptions
generateOnly = GenerateOnly `elem` otherOptions
projectWithFiles = defaultProject { projectCFlags = ["-D LOG_MEMORY" | logMemory] ++
@ -80,7 +81,7 @@ main = do setLocaleEncoding utf8
context <- loadFiles startingContext coreModulesToLoad
carpProfile <- configPath "profile.carp"
hasProfile <- doesFileExist carpProfile
context' <- if hasProfile
context' <- if (not noProfile) && hasProfile
then loadFiles context [carpProfile]
else return context
finalContext <- loadFiles context' argFilesToLoad
@ -104,6 +105,7 @@ main = do setLocaleEncoding utf8
-- | Options for how to run the compiler.
data OtherOptions = NoCore
| NoProfile
| LogMemory
| Optimize
| GenerateOnly
@ -123,6 +125,7 @@ parseArgs args = parseArgsInternal [] Repl [] args
"-i" -> parseArgsInternal filesToLoad (Install (head restArgs)) otherOptions (tail restArgs)
"--check" -> parseArgsInternal filesToLoad Check otherOptions restArgs
"--no-core" -> parseArgsInternal filesToLoad execMode (NoCore : otherOptions) restArgs
"--no-profile" -> parseArgsInternal filesToLoad execMode (NoProfile : otherOptions) restArgs
"--log-memory" -> parseArgsInternal filesToLoad execMode (LogMemory : otherOptions) restArgs
"--optimize" -> parseArgsInternal filesToLoad execMode (Optimize : otherOptions) restArgs
"--generate-only" -> parseArgsInternal filesToLoad execMode (GenerateOnly : otherOptions) restArgs

View File

@ -463,6 +463,25 @@ in the list as an argument to the function.</p>
</p>
</div>
<div class="binder">
<a class="anchor" href="#bit-width">
<h3 id="bit-width">
bit-width
</h3>
</a>
<div class="description">
command
</div>
<p class="sig">
Dynamic
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
<a class="anchor" href="#build">
<h3 id="build">

View File

@ -27,11 +27,10 @@ Get-ChildItem -Filter test/*.carp | ForEach-Object -Process {
# Just make sure these compile
exitOnError { stack exec carp "--" ./examples/mutual_recursion.carp -b }
exitOnError { stack exec carp "--" ./examples/guessing.carp -b }
exitOnError { stack exec carp "--" ./examples/no_core.carp --no-core -b }
exitOnError { stack exec carp "--" ./examples/no_core.carp --no-core --no-profile -b }
exitOnError { stack exec carp "--" ./examples/check_malloc.carp -b }
# Generate docs
exitOnError { stack exec carp "--" ./docs/core/generate_core_docs.carp }
echo "ALL TESTS DONE."

View File

@ -41,7 +41,7 @@ done
# Just make sure these compile
./carp.sh ./examples/mutual_recursion.carp -b
./carp.sh ./examples/guessing.carp -b
./carp.sh ./examples/no_core.carp --no-core -b
./carp.sh ./examples/no_core.carp --no-core --no-profile -b
./carp.sh ./examples/check_malloc.carp -b
# Run tests which rely on SDL unless the `--no_sdl` argument was passed in