summary refs log tree commit diff stats
path: root/tests/misc
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-02-08 00:47:05 -0800
committerGitHub <noreply@github.com>2021-02-08 09:47:05 +0100
commit6f6370367b31d7e8107431f3c9568956dbea6d4e (patch)
tree8263999ceb77de0681980cbab268223342d83242 /tests/misc
parentd447c0fe3f39114f0913df5804e5f7a3406d6edb (diff)
downloadNim-6f6370367b31d7e8107431f3c9568956dbea6d4e.tar.gz
fix #16949 --app:staticlib works on openbsd; --app:staticlib tested in CI (#16950)
Diffstat (limited to 'tests/misc')
-rw-r--r--tests/misc/tapp_lib_staticlib.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/misc/tapp_lib_staticlib.nim b/tests/misc/tapp_lib_staticlib.nim
new file mode 100644
index 000000000..92c9acbc3
--- /dev/null
+++ b/tests/misc/tapp_lib_staticlib.nim
@@ -0,0 +1,27 @@
+discard """
+joinable: false
+"""
+
+# bug #16949
+
+when defined case1:
+  proc foo(): int {.exportc.} = 10
+elif defined case2:
+  proc foo(): int {.exportc, dynlib.} = 10
+elif defined caseMain:
+  proc foo(): int {.importc.}
+  doAssert foo() == 10
+else:
+  import stdtest/specialpaths
+  import std/[os, strformat, strutils, compilesettings]
+  proc runCmd(cmd: string) =
+    doAssert execShellCmd(cmd) == 0, $cmd
+  const
+    file = currentSourcePath
+    nim = getCurrentCompilerExe()
+    mode = querySetting(backend)
+  proc test(lib, options: string) =
+    runCmd fmt"{nim} {mode} -o:{lib} --nomain {options} -f {file}"
+    # runCmd fmt"{nim} r -b:{mode} --passl:{lib} -d:caseMain -f {file}" # pending https://github.com/nim-lang/Nim/pull/16945
+  test(buildDir / "libD20210205T172314.a", "--app:staticlib -d:nimLinkerWeakSymbols -d:case1")
+  test(buildDir / DynlibFormat % "D20210205T172720", "--app:lib -d:case2")