| 358 | |
| 359 | |
| 360 | void FetcherCacheTest::setupArchiveAsset() |
| 361 | { |
| 362 | string path = path::join(assetsDirectory, ARCHIVED_COMMAND_NAME); |
| 363 | ASSERT_SOME(os::write(path, ARCHIVED_COMMAND_SCRIPT)); |
| 364 | |
| 365 | // Make the archived command file executable before archiving it, |
| 366 | // since the executable flag for CommandInfo::URI has no effect on |
| 367 | // what comes out of an archive. |
| 368 | ASSERT_SOME(os::chmod(path, S_IRWXU | S_IRWXG | S_IRWXO)); |
| 369 | |
| 370 | const string cwd = os::getcwd(); |
| 371 | ASSERT_SOME(os::chdir(assetsDirectory)); |
| 372 | // Create an uncompressed archive (see MESOS-3579). |
| 373 | ASSERT_SOME(os::shell( |
| 374 | "tar cf '" + ARCHIVE_NAME + "' '" + ARCHIVED_COMMAND_NAME + "' 2>&1")); |
| 375 | ASSERT_SOME(os::chdir(cwd)); |
| 376 | archivePath = path::join(assetsDirectory, ARCHIVE_NAME); |
| 377 | |
| 378 | // Make the archive file read-only, so we can tell if it becomes |
| 379 | // executable by accident. |
| 380 | ASSERT_SOME(os::chmod(archivePath, S_IRUSR | S_IRGRP | S_IROTH)); |
| 381 | } |
| 382 | |
| 383 | |
| 384 | static string taskName(int taskIndex) |