forked from rstudio/rstudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
311 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${CPACK_PACKAGE_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# CMakeLists.txt | ||
# | ||
# Copyright (C) 2009-11 by RStudio, Inc. | ||
# | ||
# This program is licensed to you under the terms of version 3 of the | ||
# GNU Affero General Public License. This program is distributed WITHOUT | ||
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
# | ||
# | ||
|
||
project(DIAGNOSTICS) | ||
|
||
# include files | ||
file(GLOB_RECURSE DIAGNOSTICS_HEADER_FILES "*.h*") | ||
|
||
# set include directories | ||
include_directories( | ||
${CORE_SOURCE_DIR}/include | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
set(DIAGNOSTICS_SOURCE_FILES | ||
DiagnosticsMain.cpp | ||
) | ||
|
||
# config file | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in | ||
${CMAKE_CURRENT_BINARY_DIR}/config.h) | ||
|
||
if(WIN32) | ||
# configure diagnostics.rc | ||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/diagnostics.rc.in | ||
${CMAKE_CURRENT_BINARY_DIR}/diagnostics.rc) | ||
|
||
|
||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/diagnostics.exe.manifest | ||
${CMAKE_CURRENT_BINARY_DIR}/diagnostics.exe.manifest COPYONLY) | ||
|
||
add_custom_command( | ||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/res.o" | ||
COMMAND windres.exe | ||
-I "." | ||
-i "diagnostics.rc" | ||
-o "${CMAKE_CURRENT_BINARY_DIR}/res.o" | ||
-Ocoff | ||
DEPENDS | ||
"${CMAKE_CURRENT_BINARY_DIR}/diagnostics.rc" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/diagnostics.exe.manifest") | ||
set(DIAGNOSTICS_SOURCE_FILES | ||
${DIAGNOSTICS_SOURCE_FILES} | ||
"${CMAKE_CURRENT_BINARY_DIR}/res.o") | ||
endif() | ||
|
||
add_executable(diagnostics | ||
${DIAGNOSTICS_SOURCE_FILES} | ||
) | ||
|
||
# set link dependencies | ||
target_link_libraries(diagnostics | ||
rstudio-core | ||
) | ||
if(NOT RSTUDIO_SESSION_WIN64) | ||
install(TARGETS diagnostics DESTINATION ${RSTUDIO_INSTALL_BIN}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* DiagnosticsMain.cpp | ||
* | ||
* Copyright (C) 2009-12 by RStudio, Inc. | ||
* | ||
* This program is licensed to you under the terms of version 3 of the | ||
* GNU Affero General Public License. This program is distributed WITHOUT | ||
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
* | ||
*/ | ||
#include <iostream> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <boost/algorithm/string.hpp> | ||
|
||
#include <core/Error.hpp> | ||
#include <core/Log.hpp> | ||
#include <core/FilePath.hpp> | ||
#include <core/FileSerializer.hpp> | ||
#include <core/system/System.hpp> | ||
|
||
#include "config.h" | ||
|
||
using namespace core; | ||
|
||
namespace { | ||
|
||
FilePath homePath() | ||
{ | ||
return core::system::userHomePath("R_USER|HOME"); | ||
} | ||
|
||
// NOTE: this code is duplicated in diagnostics as well (and also in | ||
// SessionOptions.hpp although the code path isn't exactly the same) | ||
FilePath userLogPath() | ||
{ | ||
FilePath logPath = core::system::userSettingsPath( | ||
homePath(), | ||
#ifdef RSTUDIO_SERVER | ||
"RStudio" | ||
#else | ||
"RStudio-Desktop" | ||
#endif | ||
).childPath("log"); | ||
return logPath; | ||
} | ||
|
||
void writeLogFile(const std::string& logFileName, std::ostream& ostr) | ||
{ | ||
ostr << "Log file: " << logFileName << std::endl; | ||
ostr << "--------------------------------------------------" << std::endl; | ||
ostr << std::endl; | ||
|
||
FilePath logFilePath = userLogPath().childPath(logFileName); | ||
if (logFilePath.exists()) | ||
{ | ||
std::string contents; | ||
Error error = core::readStringFromFile(logFilePath, &contents); | ||
if (error) | ||
LOG_ERROR(error); | ||
if (contents.empty()) | ||
ostr << "(Empty)" << std::endl << std::endl; | ||
else | ||
ostr << contents << std::endl; | ||
} | ||
else | ||
{ | ||
ostr << "(Not Found)" << std::endl << std::endl; | ||
} | ||
} | ||
|
||
|
||
} // anonymous namespace | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
core::system::initializeStderrLog("rstudio-diagnostics", | ||
core::system::kLogLevelWarning); | ||
|
||
// ignore SIGPIPE | ||
Error error = core::system::ignoreSignal(core::system::SigPipe); | ||
if (error) | ||
LOG_ERROR(error); | ||
|
||
writeLogFile("rdesktop.log", std::cout); | ||
writeLogFile("rsession-" + core::system::username() + ".log", std::cout); | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* config.h.in | ||
* | ||
* Copyright (C) 2009-12 by RStudio, Inc. | ||
* | ||
* This program is licensed to you under the terms of version 3 of the | ||
* GNU Affero General Public License. This program is distributed WITHOUT | ||
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
* | ||
*/ | ||
|
||
#cmakedefine RSTUDIO_SERVER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
<assemblyIdentity version="1.0.0.0" | ||
name="diagnostics" | ||
type="win32"/> | ||
<description>diagnostics</description> | ||
<!-- Identify the application security requirements. --> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges> | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!--The ID below indicates application support for Windows Vista --> | ||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> | ||
<!--The ID below indicates application support for Windows 7 --> | ||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> | ||
</application> | ||
</compatibility> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "winuser.h" | ||
|
||
1 RT_MANIFEST "diagnostics.exe.manifest" | ||
1 VERSIONINFO | ||
FILEVERSION ${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH},0 | ||
PRODUCTVERSION ${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH},0 | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "040904E4" | ||
BEGIN | ||
VALUE "CompanyName", "RStudio, Inc.\0" | ||
VALUE "FileDescription", "RStudio Diagnostics\0" | ||
VALUE "FileVersion", "${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH},0\0" | ||
VALUE "InternalName", "diagnostics\0" | ||
VALUE "LegalCopyright", "Copyright (C) 2009-11 by RStudio, Inc.\0" | ||
VALUE "LegalTrademarks", "RStudio (TM) is a trademark of RStudio, Inc.\0" | ||
VALUE "OriginalFilename", "diagnostics.exe\0" | ||
VALUE "ProductName", "RStudio\0" | ||
VALUE "ProductVersion", "${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH},0\0" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x409, 1252 | ||
END | ||
END | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Diagnostics.R | ||
# | ||
# Copyright (C) 2009-12 by RStudio, Inc. | ||
# | ||
# This program is licensed to you under the terms of version 3 of the | ||
# GNU Affero General Public License. This program is distributed WITHOUT | ||
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
# | ||
# | ||
|
||
# capture output into a file | ||
require(utils) | ||
diagnosticsFile <- normalizePath(paste("~/rstudio-diagnostics-", | ||
Sys.Date(), | ||
".txt", | ||
sep=""), | ||
mustWork = FALSE) | ||
|
||
capture.output({ | ||
|
||
# version | ||
versionFile <- "../VERSION" | ||
if (file.exists(versionFile)) { | ||
print(readLines(versionFile)) | ||
cat("\n") | ||
} | ||
|
||
# basic info | ||
print(as.list(Sys.which(c("R", | ||
"pdflatex", | ||
"bibtex", | ||
"gcc", | ||
"git", | ||
"svn")))) | ||
print(sessionInfo()) | ||
cat("\nSysInfo:\n") | ||
print(Sys.info()) | ||
cat("\nR Version:\n") | ||
print(version) | ||
print(as.list(Sys.getenv())) | ||
print(search()) | ||
|
||
cat("\nCapabilities:\n\n") | ||
print(as.list(capabilities(c("png")))) | ||
cat("\n") | ||
|
||
# locate diagonstics binary and run it | ||
sysName <- Sys.info()[['sysname']] | ||
ext <- ifelse(identical(sysName, "Windows"), ".exe", "") | ||
|
||
# first look for debug version | ||
cppDiag <- paste("../../../qtcreator-build/diagnostics/diagnostics", | ||
ext, sep="") | ||
if (!file.exists(cppDiag)) { | ||
if (identical(sysName, "Darwin")) | ||
cppDiag <- "../../MacOS/diagnostics" | ||
else | ||
cppDiag <- paste("../bin/diagnostics", ext, sep="") | ||
} | ||
|
||
if (file.exists(cppDiag)) | ||
diag <- system(cppDiag, intern=TRUE) | ||
cat(diag, sep="\n") | ||
|
||
|
||
}, file=diagnosticsFile) | ||
|
||
cat("Diagnostics written to:", diagnosticsFile, "\n") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${CPACK_PACKAGE_VERSION} |