Serial.println("foo") sends 5 characters: "f", "o", "o", "\r", "\n". You have to read the documentation for your port.readLine(), but I guess it reads till a newline character (0x0a) is read. So you have the string "foo\r" in your variable which obviously is not equal to "foo".