From: John Dallaway <john@dallaway.org.uk>
To: ecos-patches@sourceware.org
Subject: eCosTest patch
Date: Mon, 09 Feb 2009 11:06:00 -0000 [thread overview]
Message-ID: <49900E30.8000905@dallaway.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 103 bytes --]
This patch accommodates UNC paths to eCos tests and empty command
prefixes. Checked-in.
John Dallaway
[-- Attachment #2: ecostest-090209.patch --]
[-- Type: text/x-patch, Size: 4514 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/ecostest/ChangeLog,v
retrieving revision 1.19
diff -u -5 -r1.19 ChangeLog
--- ChangeLog 13 Aug 2008 09:37:07 -0000 1.19
+++ ChangeLog 9 Feb 2009 10:58:23 -0000
@@ -1,5 +1,12 @@
+2009-02-09 John Dallaway <john@dallaway.org.uk>
+
+ * common/eCosTest.cpp (CygPath): Accommodate UNC file paths.
+
+ * common/eCosTest.cpp (GetSizes): Accommodate an empty command prefix
+ string.
+
2007-10-25 Gary Thomas <gary@mlbassoc.com>
* common/eCosTest.h: Remove class qualifier - no longer legal
in GCC-4.x
Index: common/eCosTest.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/ecostest/common/eCosTest.cpp,v
retrieving revision 1.8
diff -u -5 -r1.8 eCosTest.cpp
--- common/eCosTest.cpp 29 Jan 2009 17:47:50 -0000 1.8
+++ common/eCosTest.cpp 9 Feb 2009 10:58:24 -0000
@@ -1,9 +1,9 @@
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of the eCos host tools.
-// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1998, 1999, 2000, 2009 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 or (at your option) any
// later version.
@@ -28,11 +28,11 @@
//=================================================================
//=================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): sdf
-// Contributors: sdf
+// Contributors: sdf, jld
// Date: 1999-04-01
// Description: This class abstracts a test for use in the testing infrastructure
// Usage:
//
//####DESCRIPTIONEND####
@@ -48,10 +48,14 @@
#include "eCosTestSerialFilter.h"
#include "eCosTestDownloadFilter.h"
#include "Properties.h"
#include "Subprocess.h"
+#ifdef __CYGWIN__
+#include <sys/cygwin.h> /* for cygwin_conv_to_posix_path() */
+#endif
+
#define WF(n) (n+50)/1000,((n+50)%1000)/100 // Present n as whole and fractional part. Round to nearest least significant digit
#define WFS _T("%u.%u") // The format string to output the above
LPCTSTR const CeCosTest::arResultImage[1+CeCosTest::StatusTypeMax]=
{_T("NotStarted"), _T("NoResult"), _T("Inapplicable"), _T("Pass"), _T("DTimeout"), _T("Timeout"), _T("Cancelled"), _T("Fail"), _T("AssertFail"), _T("Unknown")};
@@ -1103,11 +1107,23 @@
}
// Convert a path to something a cygwin tool will understand. Used when invoking -size and -gdb
String CeCosTest::CygPath (LPCTSTR pszPath)
{
-#ifdef _WIN32
+#ifdef __CYGWIN__
+ char buffer[MAX_PATH + 1];
+ long len = ::GetShortPathName (pszPath, NULL, 0);
+ if (len > 0) {
+ char shortpath [len + 1];
+ ::GetShortPathName (pszPath, shortpath, len + 1);
+ cygwin_conv_to_posix_path (shortpath, buffer);
+ } else {
+ cygwin_conv_to_posix_path (pszPath, buffer);
+ }
+ return buffer;
+#elif defined(_WIN32)
+#warning "native Win32 build does not support UNC file paths"
String str = "";
HKEY hKey = 0;
DWORD type;
BYTE value[256];
DWORD sz = sizeof(value);
@@ -1172,19 +1188,18 @@
bool CeCosTest::GetSizes()
{
TRACE(_T("GetSizes %s\n"),(LPCTSTR)Executable());
bool rc=false;
m_nStrippedSize=m_nFileSize=0;
- LPCTSTR pszPrefix=m_ep.Platform()->Prefix();
+ String strPrefix(m_ep.Platform()->Prefix());
+ if (strPrefix.length() > 0) strPrefix += _T("-");
struct _stat buf;
if(-1==_tstat(Executable(),&buf)){
Log(_T("%s does not exist\n"),(LPCTSTR)Executable());
- } else if (_TCHAR('\0')==*pszPrefix){
- LogString(_T("No prefix to run a size program\n"));
} else {
m_nFileSize=buf.st_size;
- const String strSizeCmd(String::SFormat(_T("%s-size %s"),pszPrefix,(LPCTSTR)CygPath(Executable())));
+ const String strSizeCmd(String::SFormat(_T("%ssize %s"),(LPCTSTR)strPrefix,(LPCTSTR)CygPath(Executable())));
String strOut;
CSubprocess sp;
if(!sp.Run(strOut,strSizeCmd)){
Log(_T("Failed to run \"%s\" - %s\n"),(LPCTSTR)strSizeCmd,(LPCTSTR)sp.ErrorString());
} else {
reply other threads:[~2009-02-09 11:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49900E30.8000905@dallaway.org.uk \
--to=john@dallaway.org.uk \
--cc=ecos-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).