Wiki

Ticket #239 (assigned defect)

Opened 14 years ago

Last modified 11 years ago

-out: does not affect -test

Reported by: Kurper Owned by: Chuck
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

Steps to reproduce:
1. Create directory, add this file to it:

# Specific DLLs shouldn't matter, just use something defined in em
@ref "bin/Lidgren.Network.dll"
use Lidgren.Network

class Program
	def main
		test
			pass
		body
			# Do something that needs the DLL.
			NetPeerConfiguration("MyExampleName")

2. Create bin/ directory in it, copy Lidgren.Network.dll into it (should work with any DLL, with test case changed appropriately)
3. "cobra test.cobra -out:bin/" works as expected
4. "cobra test.cobra -out:bin/ -test" fails with

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToken=nul
l' or one of its dependencies. The system cannot find the file specified.
File name: 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToke
n=null'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boo
lean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, E
vidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Bool
ean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence
 assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cobra.Lang.Test.TestRunner._collectTestsFor(Assembly ass, Boolean willFoll
owReferences, Set`1 found)
   at Cobra.Lang.Test.TestRunner.CollectTestsFor(Assembly ass, Boolean willFollo
wReferences)
   at Cobra.Lang.Test.TestRunner.RunTestsFor(Assembly ass, Boolean willFollowRef
erences)
   at Cobra.Lang.Test.TestRunner.RunAllTests()
   at Cobra.Lang.CobraCore.RunAllTests()
   at _GeneratedTestRunner.Main()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].

Attachments

test-and-out.patch Download (4.1 KB) - added by hopscc 12 years ago.

Change History

follow-up: ↓ 3   Changed 12 years ago by hopscc

Issue here is that -test ignores -out since it wires its own name for the test invocation/program.
Problem with that is that while -out is presented as filename change/override it actually allows a pathname including just a directory (which is the usage above).

-test should take heed of -out and use the directory portion if given...

Changed 12 years ago by hopscc

  Changed 12 years ago by hopscc

  • status changed from new to assigned
  • owner set to Chuck

Fix for accomodating directory naming in -out along with -test.
Fix up some other issues

  • -test not obeying -keep-intermediate-files and unconditionally deleting test file.
  • zero pad testfile naming as in commented TODO
  • on -test exe cleanup also cleanup any .pdb file if exists

in reply to: ↑ 1   Changed 11 years ago by nerdzero

  • owner changed from Chuck to hopscc

Replying to hopscc:

Issue here is that -test ignores -out since it wires its own name for the test invocation/program.
Problem with that is that while -out is presented as filename change/override it actually allows a pathname including just a directory (which is the usage above).

-test should take heed of -out and use the directory portion if given...

Wait, -out accepts just a directory? Is it supposed to?

"cobra -h" has this to say about "-out":

   -out:FILENAME
       Specify output file name (default: base name of first file). -test
       overrides this with a temporary program that runs only the unit tests
       and is then removed afterwards.

If so, the description of this option should be updated. If not, that should be handled correctly then.

Regardless, the real issue is finding the referenced library when using -test (been bitten by this myself) and not necessarily anything wrong with combining the -out and -test options, right?

Respecting intermediate files option, deleting the .pdb files, and zero-padding the test filename would be good to have regardless. Maybe those should be three different patches on three other tickets so they are easier to review and accept.

  Changed 11 years ago by hopscc

  • owner changed from hopscc to Chuck

" Is it supposed to?"
Dont know, dont really care - it presumably has (invisibly) since creation since didn't look like any of the code for this has changed appreciably since creation
(probably just fell out of the implementation)

cobra -h text
Its as it always has been - I dont know if its supposed to do that or not, if the display text is intended to keep that quiet or not (theres some precedent for that) - there's no comments or other indications pro or con that thats the intended behaviour but its as originally created

Regardless of that the report was about the library lookup with -test failing
(it seems reasonable that -out should work with -test as well as without)
which it was doing cos the path setups werent synced properly which this patch corrects as well as fixing the cleanup and zero padding testname since the fix just for the library lookup is, as I recollect, the trivial 2 lines in each of SharpGenerator and JavaGenerator...

The items noted above were from todo code comments noted and done in conjunction with this fix
You can probably ask for separate tickets and patches for each of these todos corrected/done but I expect you wont like the reply...

Note: See TracTickets for help on using tickets.