Removed unused test file 'process_spawn.cpp'. Review: https://reviews.apache.org/r/24582
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/30bc5477 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/30bc5477 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/30bc5477 Branch: refs/heads/master Commit: 30bc547783741654a56d66b32040da521cfa6f25 Parents: 30fdabe Author: Benjamin Mahler <[email protected]> Authored: Mon Aug 11 16:23:34 2014 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Wed Aug 13 11:54:23 2014 -0700 ---------------------------------------------------------------------- src/tests/process_spawn.cpp | 82 ---------------------------------------- 1 file changed, 82 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/30bc5477/src/tests/process_spawn.cpp ---------------------------------------------------------------------- diff --git a/src/tests/process_spawn.cpp b/src/tests/process_spawn.cpp deleted file mode 100644 index db07ba0..0000000 --- a/src/tests/process_spawn.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <iostream> -#include <climits> -#include <cstdio> - -#include <stout/duration.hpp> -#include <stout/os.hpp> - -using std::cout; -using std::cin; -using std::endl; - - -void processinfo() -{ - cout << "pid: " << getpid() - << " pgid: " << getpgrp() - << " ppid: " << getppid() - << endl; -} - - -void dummywait() -{ - while(getchar() == EOF) { - os::sleep(Seconds(INT_MAX)); - } - - cout << "Error: Shouldn't come here" << endl; -} - - -// This program forks 2 processes in a chain. The child process exits after -// forking its own child (the grandchild of the main). The grandchild is -// parented by Init but is in the same group as the main process. -int main() -{ - // Become session leader. - setsid(); - - pid_t pid = fork(); - - if (pid > 0) { - // Inside parent process. - processinfo(); - dummywait(); - } else { - // Inside child process. - processinfo(); - - pid_t pid2 = fork(); - - if (pid2 > 0) { - // Kill the child process so that the tree link is broken. - _exit(0); - } else { - // Inside grandchild process. - processinfo(); - dummywait(); - } - } - - cout << "Error: Shouldn't come here!!" << endl; - return -1; -}
