-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring and added root tests to check TUN device functionality.
- Loading branch information
Caleb James DeLisle
committed
Dec 8, 2012
1 parent
53df63c
commit be0561f
Showing
52 changed files
with
1,477 additions
and
577 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,56 @@ | ||
# You may redistribute this program and/or modify it under the terms of | ||
# the GNU General Public License as published by the Free Software Foundation, | ||
# either version 3 of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
if (NOT HasRoot_CMAKE) | ||
|
||
set(content " | ||
#ifdef WIN32 | ||
#include <windows.h> | ||
#include <string.h> | ||
int main() | ||
{ | ||
char buff[32] = {0}; | ||
DWORD length = 32; | ||
GetUserNameA(buff, &length); | ||
printf(\"%s\\n\", buff); | ||
return strcmp(\"Administrator\", buff); | ||
} | ||
#else | ||
#include <unistd.h> | ||
int main() | ||
{ | ||
return getuid(); | ||
} | ||
#endif | ||
") | ||
|
||
file(WRITE ${CMAKE_BINARY_DIR}/HasRoot.c "${content}") | ||
RemoteTest_tryRun(runRes compRes ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/HasRoot.c | ||
COMPILE_OUTPUT_VARIABLE compileOut | ||
RUN_OUTPUT_VARIABLE output | ||
) | ||
if (NOT compRes) | ||
message("${compileOut}") | ||
message(FATAL_ERROR "Compilation failed") | ||
endif() | ||
if ("${runRes}" STREQUAL "PLEASE_FILL_OUT-FAILED_TO_RUN") | ||
message(FATAL_ERROR "RunFailed") | ||
endif() | ||
if (NOT runRes) | ||
set(HasRoot TRUE CACHE INTERNAL "") | ||
message("Testing with root access, root tests enabled") | ||
else() | ||
set(HasRoot FALSE CACHE INTERNAL "") | ||
message("Testing without root access, root tests disabled") | ||
endif() | ||
|
||
set(HasRoot_CMAKE TRUE CACHE INTERNAL "") | ||
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
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
Oops, something went wrong.