Showing posts with label installation. Show all posts
Showing posts with label installation. Show all posts

Friday, April 12, 2013

Unit Tests Not Found in VS2012 and How It Was Fixed (partially)

I am setting up a virtual machine for a new upcoming project. It will use some core libraries that have already been developed in-house with Visual Studio 2012 as the development environment. The team that developed the existing libraries did a good job to make sure there was a suite of unit tests that worked and was reasonably comprehensive. So, after I installed VS2012 and Resharper I retrieved the code from the repository, compiled it and tried to run the unit tests.

The Resharper test runner (the one I normally use) listed all the tests and reported their status as "Inconclusive. Test not run."

The test runner built into Visual Studio didn't list any tests at all. Zip. Nada. Nothing.

A web search revealed some posts indicating there was a compatibility issue between VS2012 and Resharper that was supposedly fixed in VS2012's Update 2. I downloaded and installed the update.

After this, Resharper listed all the tests and reported their status as "Pending" without doing anything further. A change, but arguably not as good as before. To exit with things pending just seems strange. At least the previous "Inconclusive" state gives a sense that something's wrong, even if it doesn't say what.

On the other hand, Microsoft's test runner... still did the same thing. Absolutely no indication that any tests even existed.

After quite a bit more searching, chanting various incantations and sacrificing not a few livestock, I stumbled upon an ancient forum post from early last summer when VS2012 was still gestating as an RC. It indicated there was a bug with unit tests when they existed on a network share.

Hmm. I wanted my VM to be just the build environment and had placed the source code on a shared folder that was mapped alongside all the other source code on the host machine's disk. I wondered what would happen if I moved the code to the C: drive.

As soon as I loaded the project from its new location on C:, Microsoft's test runner immediately found and ran the tests.

Unfortunately, Resharper's still doesn't work. It continues to set them to "pending" and never does anything else. Apparently this is a known issue that hopefully will be fixed soon.

(Hopefully I've added enough keywords to this that others will be able to find this problem and solution without having to spill blood all over the keyboard.)

Friday, September 23, 2011

Sharing folders with Windows 8 between VirtualBox machines

Currently Windows 8 runs just fine inside a VirtualBox machine. However, guest additions, the tools to enable certain useful features of VirutalBox, do not yet work with Windows 8. Today I wanted to use some Visual Studio projects from an existing Windows XP virtual machine in my new Windows 8 machine. The obvious first choice was to simply use a shared folder on the host in both virtual machines. However, this requires the guest additions, so I went looking for a work around.

What I found to work was a second virtual hard drive. In VirtualBox, on my primary development machine, I created a new hard drive on the existing IDE controller. I then started the machine and went into Windows' device manager. The disk manager started the new disk wizard. After initialization, I created and formatted an NTFS partition. I then copied the files I wanted to work with to this new disk. Finally I shutdown this machine.

Next, in VirturalBox, I added the same, new hard drive image as a second drive on the Window 8 box's SATA controller. (If you add the drive to the IDE controller, Windows 8 will try to boot to it first and fail with a bad image error.) When I booted Windows 8 and went into Explorer, the second drive showed up with all the data I'd copied to it.

That's it, pretty simple and straight forward, but not the obvious (to me) first solution.

Warning: I don't know what would happen if both virtual machines are run at the same time. I suspect (and hope) the second one started would get some sort of sharing violation and not allow the disk to be mounted. I can't imagine VirtualBox is smart enough to allow two machines to attach to the same vdi file at the same time without corrupting the data. However, it seems to work just fine as long as there is only one machine using the file at any given point of time.

Hope this helps someone.

Tuesday, September 7, 2010

Synergy setup between a MacBook and Linux machine

I just got a new MacBook Pro a couple days ago. Wow, it's a nice machine. For my first Apple product, I'm pretty impressed. I have a couple things I don't like about it that I'll probably rant about some other time. But for today's post, I wanted to chronicle my adventure in getting it to be a Synergy server for an old Dell Dimension running Ubuntu. All said, it was the most problematic software configuration I've had in a really long time, but in the end I got it working pretty well. I kind of reminded me of trying to sort out IRQ and DMA addresses way back in the dark ages.

I first heard about Synergy a couple years ago when a friend of mine connected his iMac and Windows boxes together. For those who don't know, Synergy is an open source project that allows one machine's keyboard and mouse to be used on another machine in a seamless manner. The machine that has the keyboard and mouse physically connected is the server and the machine that only has a screen on it and uses the input devices from the other is the client. The two machines are connected through the network. So, this solution doesn't require any additional hardware than what the computers probably already have. Once configured, the mouse pointer can be moved off the side of one machine's screen onto another and the keyboard focus follows. It can also work with more than two machines. Any number of boxes can be setup as clients to use the common server.

Official installation instructions can be found on the Synergy wiki. I followed them mostly. Below are some issues I ran into and how I worked around them.

Step one was to download the software from the repository. For the Mac it came as a dmg file that installed without issue. For the Linux machine, it was available in both deb and rpm formats. Since I'm running Ubuntu, I loaded the deb file. It installed just fine too. In both cases, it put two applications in /usr/bin: the client, syngergyc, and the server, synergys.

Step two was to configure the server. This is done through a text file. The instructions seem to imply that it is optional, but it isn't. This is the only way to configure the server. Another point not clear in the instructions is the configuration file is only needed on the server and can be anywhere and called anything. You specify the name, including the path, on the command line for the server.

Somewhere I heard about GUI configuration tools; I thought it was on the setup page, but when I went to find it, I couldn't. Where ever I heard about them, I tried SynergyKM on the Mac. It was a dismal failure. It seemed to get confused and couldn't maintain its state very well so I eventually abandoned it, but not after wasting some time trying to get it to work. In the end, I just wrote the configuration file myself. It wasn't as hard as it first seemed. I called it /etc/synergy.

I also found a GUI tool for the Linux client and tried using it. However it used a different version of Synergy and when the Ubuntu Software Center tried to install it, it somehow messed up the apt state files. Another weird problem. I haven't had apt files get messed up in quite a while. I had to go into aptitude and do some clean-up to repair things so the GUI tools would work properly again. In the clean-up I also removed the GUI tool and just handled setup manually in a terminal window.

After installation and configuration, the next step is to run both the server and client in a terminal to test connectivity. My suggestion is to not skip this step. I thought I could and ran into some opaque problems that became obvious when I ran the software in a terminal. They all related to machine names used and my getting confused about which names to use where. By default, the instructions say the hostname is used, but that didn't really work too well for me on the Mac, so I ended up specifying my own names for the synergy connections. It took a bit for me to get this to work on both sides, mainly due to my own wrong assumptions about how things worked. When I ran things in a terminal, the error messages indicating my mis-configuration made short work of getting things sorted.

So, I once things ran in two terminal windows, the next step was to start the software automatically at startup. On the old, deprecated site, there's an Autostart Guide and this is linked to from the code.google.com wiki setup page with some additional information. I didn't see either on the new, official site and had to do some experimentation using the information from these two pages to get everything working properly. I ran into several time consuming problems doing this.

The first problem was a how to connect to the MacBook by name. The Synergy client needs either the IP address or the DNS name of the server in its command line. This makes sense from a client programming perspective. However, from a system administration perspective not so much. I'm using DHCP to assign IP addresses and as I have a small home network, I don't have a DNS server setup to handle local requests like this. The standard name resolution mechanism didn't work for me. I wanted to use the netbios name since it was available but it took a bit to figure out how to get it. In the end, I found the nmblookup command which, given the name will give some information, including the IP address. But, it's not in an incredibly useful format for scripts. I had pipe the output to grep to get just the line I wanted and then pipe that to cut to get just the IP address. Specifically the command looks like this:
nmblookup macbook_name | grep "<" | cut -f 1 -d" ".

With this in hand, I wrote a short bash script to look for a server and then connect to it once it found one. This is where I ran into my second problem. It's been a while since I've done any shell programming and I had to do a bunch of web searching to remind myself of the details. Everything indicated string equality could be done with either "==" or "=". As a C programmer, I defaulted to using "==". My script kept giving me unexpected operator errors on odd lines without operators. After commenting some lines out, I found the if statement at fault. On a whim, I changed the operator to be "=" and the problem went away.

The final version of the script became this:
#!/bin/sh
svr_ip=""
until [ "$svr_ip" != "" ]
do
svr_ip=`nmblookup macbook_name | grep "<" | cut -f 1 -d" "`
if [ "$svr_ip" = "" ]; then
sleep 2
fi
done
synergyc $svr_ip

(Note: right now this will fail if the server reboots and gets a different IP address since once syngeryc starts, it continues running even when the server goes offline.)

Once the script was done, I then followed the instructions to modify the gdm files, substituting my shell script for the synergyc call.

When this was all working, my next step was to get the autostart working on the Mac. By and large, this went faster than the Linux side but not without its own problems.

The first one was that the install location of the synergy software was different from the examples. So, the first time I tried it, it simply didn't do anything. There were no errors anywhere that I could find pointing to the problem. It was a matter of going through the script line by line until I found it.

With the software's path corrected, I ran into the second problem. When I logged on, the screen went blank and I never got anything else. The menu bar never appeared. The dock never appeared. The desktop icons never appeared. I couldn't do anything. However, the mouse moved the cursor and it would move onto the Linux desktop. Ok, I knew it was running, but how to get my desktop back? As a new Mac user I had no clue.

After a bit of searching, I found I could boot the installation CD and fire up Terminal to get to my system. I inserted the CD, held down the power button to turn the machine off and then held down the "C" key as I turned it back on. As advertised, it booted the CD and I found the terminal in the Utilities menu. I edited the script and added an ampersand to the end of the call to start the server so it would fork the process and run in a different thread. After rebooting, everything finally worked as expected.

As I said up front, once I got it working, it works really well in spite of the problematic configuration. The only issues I've found are relatively minor: 1) copy/paste doesn't work between machines, 2) the screen saver on the server doesn't cause the screen saver on the client to start, 3) I haven't gotten it to work prior to logging onto the Mac and 4) the above noted problem if the server reboots and gets a different IP address. While it'd be nice if these worked, in the greater scheme of things, they are pretty minor failures and I'll live with them for now. I think with more time the last two can be overcome with simply configuration changes that I haven't figured out yet.

Thursday, December 10, 2009

How to install Jolicloud in a VirtualBox

I ran across Jolicloud today as I surfed around the internet. It sounded like a competitor to Google's Chromium operating system and sounded interesting. Just for investigation purposes, I wanted to install it in a VirtualBox virtual machine so went to Jolicloud's download page. It gave a page of instructions that indicated I needed to download an operating system specific application and an ISO file. The application would use the ISO file build a bootable thumb drive. This drive could then install Jolicloud on the target notebook.

Not wanting to go through this hassle for a virtual machine, nor knowing if I could even boot a virtual machine with a thumb drive, I searched for instructions for a non-thumb drive install. I found several sites but apparently, they were for an earlier build that had some other bootstrap process. They mentioned using an .img file (which the current download doesn't have) and going through a number of different steps to convert it to something the VirtualBox software could read. These directions didn't seem to be appropriate for the current version. (These sites indicated they were for an Alpha release that required an invitation. At the time of this writing, the version is a PreBeta and does not require an invitation.)

I let the problem percolate in the back of my brain for a bit as I worked on other things. At some point, I realized the current build uses an ISO file. I wondered, "What are the odds that image is bootable?" Figuring the odds were good, I downloaded all 600 megabytes of it.

When the download finished, I used VirtualBox's normal creation wizard to create a simple virtual machine (512MB memory, 4GB virtual hard drive, Ethernet bridged to the host's NIC). I mounted the ISO image as the CD drive and set it as the boot drive with the virtual, empty hard drive second. When I started the machine, it booted just fine and presented a standard startup screen giving me several options, one of which was to install to the hard drive. From this point on, it proceeded as a typical install. The only things the install wanted from me were the language, keyboard layout, time zone and user information. When done, it shutdown. I unmounted the ISO file from the CD drive and turned the machine back on. Everything seems to be working perfectly so far. For whatever it's worth, it does seem to be faster than Chromium running in another, identically configured virtual machine.

That's it. Very painless. Everything just worked.