diff --git a/core/authorize.php b/core/authorize.php
index c6ba51d..8b7932d 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -78,8 +78,8 @@ global $conf;
 
 // We have to enable the user and system modules, even to check access and
 // display errors via the maintenance theme.
-$module_list['system']['filename'] = 'core/modules/system/system.module';
-$module_list['user']['filename'] = 'core/modules/user/user.module';
+$module_list['system']['uri'] = 'core/modules/system';
+$module_list['user']['uri'] = 'core/modules/user';
 module_list(TRUE, FALSE, FALSE, $module_list);
 drupal_load('module', 'system');
 drupal_load('module', 'user');
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index c26ec86..beb2947 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -741,9 +741,9 @@ function drupal_get_filename($type, $name, $filename = NULL) {
   else {
     try {
       if (function_exists('db_query')) {
-        $file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField();
+        $file = db_query("SELECT uri FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField();
         if (file_exists(DRUPAL_ROOT . '/' . $file)) {
-          $files[$type][$name] = $file;
+          $files[$type][$name] = $file . '/' . $name . '.' . $type;
         }
       }
     }
@@ -998,14 +998,18 @@ function drupal_load($type, $name) {
 
   $filename = drupal_get_filename($type, $name);
 
-  if ($filename) {
-    include_once DRUPAL_ROOT . '/' . $filename;
-    $files[$type][$name] = TRUE;
+  if (!$filename) {
+    return FALSE;
+  }
 
-    return TRUE;
+  $filename = DRUPAL_ROOT . '/' . $filename;
+
+  if (is_file($filename)) {
+    include_once $filename;
   }
+  $files[$type][$name] = TRUE;
 
-  return FALSE;
+  return TRUE;
 }
 
 /**
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 7ce1994..97f5b05 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -5338,7 +5338,7 @@ function drupal_cron_cleanup() {
  * depending on what type of object you are looking for. For instance, if you
  * are looking for modules and call:
  * @code
- * drupal_system_listing("/\.module$/", "modules", 'name', 0);
+ * drupal_system_listing("/\.info$/", "modules", 'name', 0);
  * @endcode
  * this function will search the site-wide modules directory (i.e., /modules/),
  * your install profile's directory (i.e.,
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 07e25a0..704f8b4 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -279,9 +279,9 @@ function install_begin_request(&$install_state) {
   drupal_language_initialize();
 
   require_once DRUPAL_ROOT . '/core/includes/ajax.inc';
-  $module_list['system']['filename'] = 'core/modules/system/system.module';
-  $module_list['entity']['filename'] = 'core/modules/entity/entity.module';
-  $module_list['user']['filename']   = 'core/modules/user/user.module';
+  $module_list['system']['uri'] = 'core/modules/system';
+  $module_list['entity']['uri'] = 'core/modules/entity';
+  $module_list['user']['uri']   = 'core/modules/user';
   module_list(TRUE, FALSE, FALSE, $module_list);
   drupal_load('module', 'system');
   drupal_load('module', 'entity');
diff --git a/core/includes/install.inc b/core/includes/install.inc
index 199ec1c..19b5aea 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -160,7 +160,7 @@ function drupal_get_database_types() {
   require_once DRUPAL_ROOT . '/core/includes/database.inc';
   foreach (file_scan_directory(DRUPAL_ROOT . '/core/lib/Drupal/Core/Database/Driver', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) {
     if (file_exists($file->uri . '/Install/Tasks.php')) {
-      $drivers[$file->filename] = $file->uri;
+      $drivers[basename($file->uri)] = $file->uri;
     }
   }
 
@@ -282,7 +282,7 @@ function drupal_verify_profile($install_state) {
 
   // Get a list of modules that exist in Drupal's assorted subdirectories.
   $present_modules = array();
-  foreach (drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0) as $present_module) {
+  foreach (drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'modules', 'name', 0) as $present_module) {
     $present_modules[] = $present_module->name;
   }
 
@@ -324,9 +324,9 @@ function drupal_install_system() {
   $system_versions = drupal_get_schema_versions('system');
   $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
   db_insert('system')
-    ->fields(array('filename', 'name', 'type', 'owner', 'status', 'schema_version', 'bootstrap'))
+    ->fields(array('uri', 'name', 'type', 'owner', 'status', 'schema_version', 'bootstrap'))
     ->values(array(
-        'filename' => $system_path . '/system.module',
+        'uri' => $system_path,
         'name' => 'system',
         'type' => 'module',
         'owner' => '',
diff --git a/core/includes/module.inc b/core/includes/module.inc
index df9c138..424a3f0 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -71,7 +71,7 @@ function module_list($refresh = FALSE, $bootstrap_refresh = FALSE, $sort = FALSE
     $sorted_list = NULL;
     if ($fixed_list) {
       foreach ($fixed_list as $name => $module) {
-        drupal_get_filename('module', $name, $module['filename']);
+        drupal_get_filename('module', $name, $module['uri'] . '/' . $name . '.' . $module);
         $list[$name] = $name;
       }
     }
@@ -133,15 +133,16 @@ function system_list($type) {
       $bootstrap_list = $cached->data;
     }
     else {
-      $bootstrap_list = db_query("SELECT name, filename FROM {system} WHERE status = 1 AND bootstrap = 1 AND type = 'module' ORDER BY weight ASC, name ASC")->fetchAllAssoc('name');
+      $bootstrap_list = db_query("SELECT name, uri FROM {system} WHERE status = 1 AND bootstrap = 1 AND type = 'module' ORDER BY weight ASC, name ASC")->fetchAllAssoc('name');
       cache('bootstrap')->set('bootstrap_modules', $bootstrap_list);
     }
     // To avoid a separate database lookup for the filepath, prime the
     // drupal_get_filename() static cache for bootstrap modules only.
     // The rest is stored separately to keep the bootstrap module cache small.
     foreach ($bootstrap_list as $module) {
-      drupal_classloader_register($module->name, dirname($module->filename));
-      drupal_get_filename('module', $module->name, $module->filename);
+      drupal_classloader_register($module->name, $module->uri);
+      $filename = $module->uri . '/' . $module->name . '.module';
+      drupal_get_filename('module', $module->name, $filename);
     }
     // We only return the module names here since module_list() doesn't need
     // the filename itself.
@@ -176,7 +177,8 @@ function system_list($type) {
         }
         // Build a list of filenames so drupal_get_filename can use it.
         if ($record->status) {
-          $lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename);
+          $filepath = $record->uri . '/' . $record->name . '.' . $record->type;
+          $lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $filepath);
         }
       }
       foreach ($lists['theme'] as $key => $theme) {
diff --git a/core/includes/registry.inc b/core/includes/registry.inc
index 7ac2960..ee26b19 100644
--- a/core/includes/registry.inc
+++ b/core/includes/registry.inc
@@ -35,7 +35,7 @@ function _registry_update() {
   $files = array();
   foreach ($modules as &$module) {
     $module->info = unserialize($module->info);
-    $dir = dirname($module->filename);
+    $dir = $module->uri;
 
     // Store the module directory for use in hook_registry_files_alter().
     $module->dir = $dir;
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index d044f06..9a20b7d 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -142,7 +142,7 @@ function _drupal_theme_initialize($theme, $base_theme = array(), $registry_callb
   $theme_info = $theme;
   $base_theme_info = $base_theme;
 
-  $theme_path = dirname($theme->filename);
+  $theme_path = $theme->uri;
 
   // Prepare stylesheets from this theme as well as all ancestor themes.
   // We work it this way so that we can have child themes override parent
@@ -689,11 +689,11 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
 
   // And then the same thing, but for the theme.
   if ($theme_engine) {
-    _theme_process_registry($cache, $theme_engine, 'theme_engine', $theme->name, dirname($theme->filename));
+    _theme_process_registry($cache, $theme_engine, 'theme_engine', $theme->name, $theme->uri);
   }
 
   // Finally, hooks provided by the theme itself.
-  _theme_process_registry($cache, $theme->name, 'theme', $theme->name, dirname($theme->filename));
+  _theme_process_registry($cache, $theme->name, 'theme', $theme->name, $theme->uri);
 
   // Let modules alter the registry.
   drupal_alter('theme_registry', $cache);
@@ -1414,7 +1414,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
       // Generate the path to the logo image.
       if ($cache[$theme]['toggle_logo']) {
         if ($cache[$theme]['default_logo']) {
-          $cache[$theme]['logo'] = file_create_url(dirname($theme_object->filename) . '/logo.png');
+          $cache[$theme]['logo'] = file_create_url($theme_object->uri . '/logo.png');
         }
         elseif ($cache[$theme]['logo_path']) {
           $cache[$theme]['logo'] = file_create_url($cache[$theme]['logo_path']);
@@ -1424,7 +1424,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
       // Generate the path to the favicon.
       if ($cache[$theme]['toggle_favicon']) {
         if ($cache[$theme]['default_favicon']) {
-          if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) {
+          if (file_exists($favicon = $theme_object->uri . '/favicon.ico')) {
             $cache[$theme]['favicon'] = file_create_url($favicon);
           }
           else {
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index 3fd60c9..3366c54 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -55,7 +55,7 @@ function _drupal_maintenance_theme() {
 
   // Ensure that system.module is loaded.
   if (!function_exists('_system_rebuild_theme_data')) {
-    $module_list['system']['filename'] = 'core/modules/system/system.module';
+    $module_list['system']['uri'] = 'core/modules/system';
     module_list(TRUE, FALSE, FALSE, $module_list);
     drupal_load('module', 'system');
   }
diff --git a/core/modules/entity/tests/entity_cache_test.info b/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info
similarity index 100%
rename from core/modules/entity/tests/entity_cache_test.info
rename to core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info
diff --git a/core/modules/entity/tests/entity_cache_test.module b/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module
similarity index 100%
rename from core/modules/entity/tests/entity_cache_test.module
rename to core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module
diff --git a/core/modules/entity/tests/entity_cache_test_dependency.info b/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info
similarity index 100%
rename from core/modules/entity/tests/entity_cache_test_dependency.info
rename to core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info
diff --git a/core/modules/entity/tests/entity_cache_test_dependency.module b/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
similarity index 100%
rename from core/modules/entity/tests/entity_cache_test_dependency.module
rename to core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
diff --git a/core/modules/entity/tests/entity_crud_hook_test.info b/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info
similarity index 100%
rename from core/modules/entity/tests/entity_crud_hook_test.info
rename to core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info
diff --git a/core/modules/entity/tests/entity_crud_hook_test.module b/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
similarity index 100%
rename from core/modules/entity/tests/entity_crud_hook_test.module
rename to core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
diff --git a/core/modules/entity/tests/entity_test.info b/core/modules/entity/tests/modules/entity_test/entity_test.info
similarity index 100%
rename from core/modules/entity/tests/entity_test.info
rename to core/modules/entity/tests/modules/entity_test/entity_test.info
diff --git a/core/modules/entity/tests/entity_test.install b/core/modules/entity/tests/modules/entity_test/entity_test.install
similarity index 100%
rename from core/modules/entity/tests/entity_test.install
rename to core/modules/entity/tests/modules/entity_test/entity_test.install
diff --git a/core/modules/entity/tests/entity_test.module b/core/modules/entity/tests/modules/entity_test/entity_test.module
similarity index 100%
rename from core/modules/entity/tests/entity_test.module
rename to core/modules/entity/tests/modules/entity_test/entity_test.module
diff --git a/core/modules/node/tests/node_access_test.info b/core/modules/node/tests/modules/node_access_test/node_access_test.info
similarity index 100%
rename from core/modules/node/tests/node_access_test.info
rename to core/modules/node/tests/modules/node_access_test/node_access_test.info
diff --git a/core/modules/node/tests/node_access_test.install b/core/modules/node/tests/modules/node_access_test/node_access_test.install
similarity index 100%
rename from core/modules/node/tests/node_access_test.install
rename to core/modules/node/tests/modules/node_access_test/node_access_test.install
diff --git a/core/modules/node/tests/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
similarity index 100%
rename from core/modules/node/tests/node_access_test.module
rename to core/modules/node/tests/modules/node_access_test/node_access_test.module
diff --git a/core/modules/node/tests/node_test.info b/core/modules/node/tests/modules/node_test/node_test.info
similarity index 100%
rename from core/modules/node/tests/node_test.info
rename to core/modules/node/tests/modules/node_test/node_test.info
diff --git a/core/modules/node/tests/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
similarity index 100%
rename from core/modules/node/tests/node_test.module
rename to core/modules/node/tests/modules/node_test/node_test.module
diff --git a/core/modules/node/tests/node_test_exception.info b/core/modules/node/tests/modules/node_test_exception/node_test_exception.info
similarity index 100%
rename from core/modules/node/tests/node_test_exception.info
rename to core/modules/node/tests/modules/node_test_exception/node_test_exception.info
diff --git a/core/modules/node/tests/node_test_exception.module b/core/modules/node/tests/modules/node_test_exception/node_test_exception.module
similarity index 100%
rename from core/modules/node/tests/node_test_exception.module
rename to core/modules/node/tests/modules/node_test_exception/node_test_exception.module
diff --git a/core/modules/search/tests/search_embedded_form.info b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.info
similarity index 100%
rename from core/modules/search/tests/search_embedded_form.info
rename to core/modules/search/tests/modules/search_embedded_form/search_embedded_form.info
diff --git a/core/modules/search/tests/search_embedded_form.module b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module
similarity index 100%
rename from core/modules/search/tests/search_embedded_form.module
rename to core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module
diff --git a/core/modules/search/tests/search_extra_type.info b/core/modules/search/tests/modules/search_extra_type/search_extra_type.info
similarity index 100%
rename from core/modules/search/tests/search_extra_type.info
rename to core/modules/search/tests/modules/search_extra_type/search_extra_type.info
diff --git a/core/modules/search/tests/search_extra_type.module b/core/modules/search/tests/modules/search_extra_type/search_extra_type.module
similarity index 100%
rename from core/modules/search/tests/search_extra_type.module
rename to core/modules/search/tests/modules/search_extra_type/search_extra_type.module
diff --git a/core/modules/simpletest/simpletest.info b/core/modules/simpletest/simpletest.info
index cf55121..7797fc5 100644
--- a/core/modules/simpletest/simpletest.info
+++ b/core/modules/simpletest/simpletest.info
@@ -6,41 +6,3 @@ core = 8.x
 files[] = simpletest.test
 files[] = drupal_web_test_case.php
 configure = admin/config/development/testing/settings
-
-; Tests in tests directory.
-files[] = tests/actions.test
-files[] = tests/ajax.test
-files[] = tests/batch.test
-files[] = tests/bootstrap.test
-files[] = tests/cache.test
-files[] = tests/common.test
-files[] = tests/database_test.test
-files[] = tests/error.test
-files[] = tests/file.test
-files[] = tests/filetransfer.test
-files[] = tests/form.test
-files[] = tests/graph.test
-files[] = tests/image.test
-files[] = tests/installer.test
-files[] = tests/lock.test
-files[] = tests/mail.test
-files[] = tests/menu.test
-files[] = tests/module.test
-files[] = tests/pager.test
-files[] = tests/password.test
-files[] = tests/path.test
-files[] = tests/queue.test
-files[] = tests/registry.test
-files[] = tests/schema.test
-files[] = tests/session.test
-files[] = tests/symfony.test
-files[] = tests/tablesort.test
-files[] = tests/theme.test
-files[] = tests/unicode.test
-files[] = tests/update.test
-files[] = tests/uuid.test
-files[] = tests/xmlrpc.test
-files[] = tests/upgrade/upgrade.test
-files[] = tests/upgrade/upgrade_bare.test
-files[] = tests/upgrade/upgrade_filled.test
-files[] = tests/upgrade/upgrade.language.test
diff --git a/core/modules/simpletest/simpletest.test b/core/modules/simpletest/simpletest.test
index 55a48be..4cecbe6 100644
--- a/core/modules/simpletest/simpletest.test
+++ b/core/modules/simpletest/simpletest.test
@@ -86,9 +86,9 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
   function testUserAgentValidation() {
     if (!$this->inCURL()) {
       global $base_url;
-      $simpletest_path = $base_url . '/' . drupal_get_path('module', 'simpletest');
-      $HTTP_path = $simpletest_path .'/tests/http.php?q=node';
-      $https_path = $simpletest_path .'/tests/https.php?q=node';
+      $system_path = $base_url . '/' . drupal_get_path('module', 'system');
+      $HTTP_path = $system_path .'/tests/http.php?q=node';
+      $https_path = $system_path .'/tests/https.php?q=node';
       // Generate a valid simpletest User-Agent to pass validation.
       $this->assertTrue(preg_match('/simpletest\d+/', $this->databasePrefix, $matches), t('Database prefix contains simpletest prefix.'));
       $test_ua = drupal_generate_test_ua($matches[0]);
diff --git a/core/modules/system/system.info b/core/modules/system/system.info
index f082cd5..40992fd 100644
--- a/core/modules/system/system.info
+++ b/core/modules/system/system.info
@@ -6,3 +6,41 @@ core = 8.x
 files[] = system.test
 required = TRUE
 configure = admin/config/system
+
+; Tests in tests directory.
+files[] = tests/actions.test
+files[] = tests/ajax.test
+files[] = tests/batch.test
+files[] = tests/bootstrap.test
+files[] = tests/cache.test
+files[] = tests/common.test
+files[] = tests/database_test.test
+files[] = tests/error.test
+files[] = tests/file.test
+files[] = tests/filetransfer.test
+files[] = tests/form.test
+files[] = tests/graph.test
+files[] = tests/image.test
+files[] = tests/installer.test
+files[] = tests/lock.test
+files[] = tests/mail.test
+files[] = tests/menu.test
+files[] = tests/module.test
+files[] = tests/pager.test
+files[] = tests/password.test
+files[] = tests/path.test
+files[] = tests/queue.test
+files[] = tests/registry.test
+files[] = tests/schema.test
+files[] = tests/session.test
+files[] = tests/symfony.test
+files[] = tests/tablesort.test
+files[] = tests/theme.test
+files[] = tests/unicode.test
+files[] = tests/update.test
+files[] = tests/uuid.test
+files[] = tests/xmlrpc.test
+files[] = tests/upgrade/upgrade.test
+files[] = tests/upgrade/upgrade_bare.test
+files[] = tests/upgrade/upgrade_filled.test
+files[] = tests/upgrade/upgrade.language.test
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 905d11d..5c25761 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1533,11 +1533,11 @@ function system_schema() {
   $schema['system'] = array(
     'description' => "A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system.",
     'fields' => array(
-      'filename' => array(
-        'description' => 'The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
+      'uri' => array(
+        'description' => 'The path to the folder containing the item, relative to the Drupal root; e.g. modules/node/.',
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
         'default' => '',
       ),
       'name' => array(
@@ -1592,7 +1592,7 @@ function system_schema() {
         'not null' => FALSE,
       ),
     ),
-    'primary key' => array('filename'),
+    'primary key' => array('uri'),
     'indexes' => array(
       'system_list' => array('status', 'bootstrap', 'type', 'weight', 'name'),
       'type_name' => array('type', 'name'),
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index fd571ce..f04c05d 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2238,10 +2238,9 @@ function system_check_directory($form_element) {
  */
 function system_get_files_database(&$files, $type) {
   // Extract current files from database.
-  $result = db_query("SELECT filename, name, type, status, schema_version, weight FROM {system} WHERE type = :type", array(':type' => $type));
+  $result = db_query("SELECT uri, name, type, status, schema_version, weight FROM {system} WHERE type = :type", array(':type' => $type));
   foreach ($result as $file) {
     if (isset($files[$file->name]) && is_object($files[$file->name])) {
-      $file->uri = $file->filename;
       foreach ($file as $key => $value) {
         if (!isset($files[$file->name]->$key)) {
           $files[$file->name]->$key = $value;
@@ -2267,7 +2266,7 @@ function system_update_files_database(&$files, $type) {
   foreach ($result as $file) {
     if (isset($files[$file->name]) && is_object($files[$file->name])) {
       // Keep the old filename from the database in case the file has moved.
-      $old_filename = $file->filename;
+      $old_uri = $file->uri;
 
       $updated_fields = array();
 
@@ -2289,7 +2288,7 @@ function system_update_files_database(&$files, $type) {
       if (count($updated_fields)) {
         db_update('system')
           ->fields($updated_fields)
-          ->condition('filename', $old_filename)
+          ->condition('uri', $old_uri)
           ->execute();
       }
 
@@ -2298,7 +2297,7 @@ function system_update_files_database(&$files, $type) {
     }
     else {
       // File is not found in file system, so delete record from the system table.
-      $delete->condition('filename', $file->filename);
+      $delete->condition('uri', $file->uri);
     }
   }
 
@@ -2312,14 +2311,14 @@ function system_update_files_database(&$files, $type) {
   }
 
   // All remaining files are not in the system table, so we need to add them.
-  $query = db_insert('system')->fields(array('filename', 'name', 'type', 'owner', 'info'));
+  $query = db_insert('system')->fields(array('uri', 'name', 'type', 'owner', 'info'));
   foreach ($files as &$file) {
     if (isset($file->exists)) {
       unset($file->exists);
     }
     else {
       $query->values(array(
-        'filename' => $file->uri,
+        'uri' => $file->uri,
         'name' => $file->name,
         'type' => $type,
         'owner' => isset($file->owner) ? $file->owner : '',
@@ -2385,13 +2384,13 @@ function system_get_info($type, $name = NULL) {
  */
 function _system_rebuild_module_data() {
   // Find modules
-  $modules = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0);
+  $modules = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'modules', 'name', 0);
 
   // Include the install profile in modules that are loaded.
   $profile = drupal_get_profile();
   $modules[$profile] = new stdClass();
   $modules[$profile]->name = $profile;
-  $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
+  $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.info';
 
   // Install profile hooks are always executed last.
   $modules[$profile]->weight = 1000;
@@ -2409,12 +2408,15 @@ function _system_rebuild_module_data() {
 
   // Read info files for each module.
   foreach ($modules as $key => $module) {
-    // The module system uses the key 'filename' instead of 'uri' so copy the
-    // value so it will be used by the modules system.
-    $modules[$key]->filename = $module->uri;
+
+    // Remove themes inside modules.
+    if (strpos($module->uri, 'themes') > strpos($module->uri, 'modules')) {
+      unset($modules[$key]);
+      continue;
+    }
 
     // Look for the info file.
-    $module->info = drupal_parse_info_file(dirname($module->uri) . '/' . $module->name . '.info');
+    $module->info = drupal_parse_info_file($module->uri);
 
     // Skip modules that don't provide info.
     if (empty($module->info)) {
@@ -2422,9 +2424,16 @@ function _system_rebuild_module_data() {
       continue;
     }
 
+    // The URI found is an .info file, the directory is the
+    // module container that we store in the system table.
+    $modules[$key]->uri = dirname($module->uri);
+
     // Merge in defaults and save.
     $modules[$key]->info = $module->info + $defaults;
 
+
+
+
     // Prefix stylesheets and scripts with module path.
     $path = dirname($module->uri);
     if (isset($module->info['stylesheets'])) {
@@ -2523,7 +2532,6 @@ function _system_rebuild_theme_data() {
       // @see file_scan_directory()
       $themes[$name] = (object) array(
         'uri' => $uri,
-        'filename' => pathinfo($uri, PATHINFO_FILENAME),
         'name' => $name,
       );
     }
@@ -2557,41 +2565,43 @@ function _system_rebuild_theme_data() {
   $sub_themes = array();
   // Read info files for each theme
   foreach ($themes as $key => $theme) {
-    $themes[$key]->filename = $theme->uri;
-    $themes[$key]->info = drupal_parse_info_file($theme->uri) + $defaults;
+    // Change uri to theme directory.
+    $theme->uri = dirname($theme->uri);
+
+    $theme->info = drupal_parse_info_file($theme->uri . '/' . $theme->name . '.info') + $defaults;
 
     // Invoke hook_system_info_alter() to give installed modules a chance to
     // modify the data in the .info files if necessary.
     $type = 'theme';
-    drupal_alter('system_info', $themes[$key]->info, $themes[$key], $type);
+    drupal_alter('system_info', $theme->info, $theme, $type);
 
-    if (!empty($themes[$key]->info['base theme'])) {
-      $sub_themes[] = $key;
+    if (!empty($theme->info['base theme'])) {
+      $sub_themes[] = $theme->name;
     }
-    if ($themes[$key]->info['engine'] == 'theme') {
-      $filename = dirname($themes[$key]->uri) . '/' . $themes[$key]->name . '.theme';
+    if ($theme->info['engine'] == 'theme') {
+      $filename = dirname($theme->uri) . '/' . $theme->name . '.theme';
       if (file_exists($filename)) {
-        $themes[$key]->owner = $filename;
-        $themes[$key]->prefix = $key;
+        $theme->owner = $filename;
+        $theme->prefix = $theme->name;
       }
     }
     else {
-      $engine = $themes[$key]->info['engine'];
+      $engine = $theme->info['engine'];
       if (isset($engines[$engine])) {
-        $themes[$key]->owner = $engines[$engine]->uri;
-        $themes[$key]->prefix = $engines[$engine]->name;
-        $themes[$key]->template = TRUE;
+        $theme->owner = $engines[$engine]->uri;
+        $theme->prefix = $engines[$engine]->name;
+        $theme->template = TRUE;
       }
     }
 
     // Prefix stylesheets and scripts with module path.
-    $path = dirname($theme->uri);
+    $path = $theme->uri;
     $theme->info['stylesheets'] = _system_info_add_path($theme->info['stylesheets'], $path);
     $theme->info['scripts'] = _system_info_add_path($theme->info['scripts'], $path);
 
     // Give the screenshot proper path information.
-    if (!empty($themes[$key]->info['screenshot'])) {
-      $themes[$key]->info['screenshot'] = $path . '/' . $themes[$key]->info['screenshot'];
+    if (!empty($theme->info['screenshot'])) {
+      $theme->info['screenshot'] = $path . '/' . $theme->info['screenshot'];
     }
   }
 
diff --git a/core/modules/simpletest/tests/actions.test b/core/modules/system/tests/actions.test
similarity index 100%
rename from core/modules/simpletest/tests/actions.test
rename to core/modules/system/tests/actions.test
diff --git a/core/modules/simpletest/tests/ajax.test b/core/modules/system/tests/ajax.test
similarity index 100%
rename from core/modules/simpletest/tests/ajax.test
rename to core/modules/system/tests/ajax.test
diff --git a/core/modules/simpletest/tests/batch.test b/core/modules/system/tests/batch.test
similarity index 100%
rename from core/modules/simpletest/tests/batch.test
rename to core/modules/system/tests/batch.test
diff --git a/core/modules/simpletest/tests/bootstrap.test b/core/modules/system/tests/bootstrap.test
similarity index 100%
rename from core/modules/simpletest/tests/bootstrap.test
rename to core/modules/system/tests/bootstrap.test
diff --git a/core/modules/simpletest/tests/cache.test b/core/modules/system/tests/cache.test
similarity index 100%
rename from core/modules/simpletest/tests/cache.test
rename to core/modules/system/tests/cache.test
diff --git a/core/modules/simpletest/tests/common.test b/core/modules/system/tests/common.test
similarity index 99%
rename from core/modules/simpletest/tests/common.test
rename to core/modules/system/tests/common.test
index 4f20361..abb42e9 100644
--- a/core/modules/simpletest/tests/common.test
+++ b/core/modules/system/tests/common.test
@@ -615,14 +615,14 @@ class CommonCascadingStylesheetsTestCase extends DrupalWebTestCase {
     // Verify common_test.css in a STYLE media="all" tag.
     $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
       ':media' => 'all',
-      ':filename' => 'tests/common_test.css',
+      ':filename' => 'tests/modules/common_test/common_test.css',
     ));
     $this->assertTrue(count($elements), "Stylesheet with media 'all' in module .info file found.");
 
     // Verify common_test.print.css in a STYLE media="print" tag.
     $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
       ':media' => 'print',
-      ':filename' => 'tests/common_test.print.css',
+      ':filename' => 'tests/modules/common_test/common_test.print.css',
     ));
     $this->assertTrue(count($elements), "Stylesheet with media 'print' in module .info file found.");
   }
@@ -767,23 +767,22 @@ class CommonCascadingStylesheetsTestCase extends DrupalWebTestCase {
    */
   function testRenderOverride() {
     $system = drupal_get_path('module', 'system');
-    $simpletest = drupal_get_path('module', 'simpletest');
 
     drupal_add_css($system . '/system.base.css');
-    drupal_add_css($simpletest . '/tests/system.base.css');
+    drupal_add_css($system . '/tests/system.base.css');
 
     // The dummy stylesheet should be the only one included.
     $styles = drupal_get_css();
-    $this->assert(strpos($styles, $simpletest . '/tests/system.base.css') !== FALSE, t('The overriding CSS file is output.'));
+    $this->assert(strpos($styles, $system . '/tests/system.base.css') !== FALSE, t('The overriding CSS file is output.'));
     $this->assert(strpos($styles, $system . '/system.base.css') === FALSE, t('The overridden CSS file is not output.'));
 
-    drupal_add_css($simpletest . '/tests/system.base.css');
+    drupal_add_css($system . '/tests/system.base.css');
     drupal_add_css($system . '/system.base.css');
 
     // The standard stylesheet should be the only one included.
     $styles = drupal_get_css();
     $this->assert(strpos($styles, $system . '/system.base.css') !== FALSE, t('The overriding CSS file is output.'));
-    $this->assert(strpos($styles, $simpletest . '/tests/system.base.css') === FALSE, t('The overridden CSS file is not output.'));
+    $this->assert(strpos($styles, $system . '/tests/system.base.css') === FALSE, t('The overridden CSS file is not output.'));
   }
 
   /**
@@ -2249,7 +2248,7 @@ class CommonDrupalParseInfoFileTestCase extends DrupalUnitTestCase {
    * Parse an example .info file an verify the results.
    */
   function testParseInfoFile() {
-    $info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt');
+    $info_values = drupal_parse_info_file(drupal_get_path('module', 'system') . '/tests/common_test_info.txt');
     $this->assertEqual($info_values['simple_string'], 'A simple string', t('Simple string value was parsed correctly.'), t('System'));
     $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, t('Constant value was parsed correctly.'), t('System'));
     $this->assertEqual($info_values['double_colon'], 'dummyClassName::', t('Value containing double-colon was parsed correctly.'), t('System'));
@@ -2279,14 +2278,14 @@ class CommonDrupalSystemListingTestCase extends DrupalWebTestCase {
       // with Drupal core, the copy in the core modules directory takes
       // precedence.
       'drupal_system_listing_incompatible_test' => array(
-        'core/modules/simpletest/tests',
+        'core/modules/system/tests/modules',
         'profiles/testing/modules',
       ),
       // When both copies of the module are compatible with Drupal core, the
       // copy in the profile directory takes precedence.
       'drupal_system_listing_compatible_test' => array(
         'profiles/testing/modules',
-        'core/modules/simpletest/tests',
+        'core/modules/system/tests/modules',
       ),
     );
 
diff --git a/core/modules/simpletest/tests/common_test_info.txt b/core/modules/system/tests/common_test_info.txt
similarity index 100%
rename from core/modules/simpletest/tests/common_test_info.txt
rename to core/modules/system/tests/common_test_info.txt
diff --git a/core/modules/simpletest/tests/error.test b/core/modules/system/tests/error.test
similarity index 90%
rename from core/modules/simpletest/tests/error.test
rename to core/modules/system/tests/error.test
index 8c5a848..ead3526 100644
--- a/core/modules/simpletest/tests/error.test
+++ b/core/modules/system/tests/error.test
@@ -24,19 +24,19 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
       '%type' => 'Notice',
       '!message' => 'Undefined variable: bananas',
       '%function' => 'error_test_generate_warnings()',
-      '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'),
+      '%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
     );
     $error_warning = array(
       '%type' => 'Warning',
       '!message' => 'Division by zero',
       '%function' => 'error_test_generate_warnings()',
-      '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'),
+      '%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
     );
     $error_user_notice = array(
       '%type' => 'User warning',
       '!message' => 'Drupal is awesome',
       '%function' => 'error_test_generate_warnings()',
-      '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'),
+      '%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
     );
 
     // Set error reporting to collect notices.
@@ -73,14 +73,14 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
       '!message' => 'Drupal is awesome',
       '%function' => 'error_test_trigger_exception()',
       '%line' => 57,
-      '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'),
+      '%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
     );
     $error_pdo_exception = array(
       '%type' => 'PDOException',
       '!message' => 'SELECT * FROM bananas_are_awesome',
       '%function' => 'error_test_trigger_pdo_exception()',
       '%line' => 65,
-      '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'),
+      '%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
     );
 
     $this->drupalGet('error-test/trigger-exception');
diff --git a/core/modules/simpletest/tests/file.test b/core/modules/system/tests/file.test
similarity index 100%
rename from core/modules/simpletest/tests/file.test
rename to core/modules/system/tests/file.test
diff --git a/core/modules/simpletest/tests/filetransfer.test b/core/modules/system/tests/filetransfer.test
similarity index 100%
rename from core/modules/simpletest/tests/filetransfer.test
rename to core/modules/system/tests/filetransfer.test
diff --git a/core/modules/simpletest/tests/form.test b/core/modules/system/tests/form.test
similarity index 100%
rename from core/modules/simpletest/tests/form.test
rename to core/modules/system/tests/form.test
diff --git a/core/modules/simpletest/tests/graph.test b/core/modules/system/tests/graph.test
similarity index 100%
rename from core/modules/simpletest/tests/graph.test
rename to core/modules/system/tests/graph.test
diff --git a/core/modules/simpletest/tests/http.php b/core/modules/system/tests/http.php
similarity index 89%
rename from core/modules/simpletest/tests/http.php
rename to core/modules/system/tests/http.php
index 91985a6..2481d16 100644
--- a/core/modules/simpletest/tests/http.php
+++ b/core/modules/system/tests/http.php
@@ -12,7 +12,7 @@ $is_http_mock = !empty($_SERVER['HTTPS']);
 $_SERVER['HTTPS'] = NULL;
 ini_set('session.cookie_secure', FALSE);
 foreach ($_SERVER as $key => $value) {
-  $_SERVER[$key] = str_replace('core/modules/simpletest/tests/http.php', 'index.php', $value);
+  $_SERVER[$key] = str_replace('core/modules/system/tests/http.php', 'index.php', $value);
   $_SERVER[$key] = str_replace('https://', 'http://', $_SERVER[$key]);
 }
 
diff --git a/core/modules/simpletest/tests/https.php b/core/modules/system/tests/https.php
similarity index 89%
rename from core/modules/simpletest/tests/https.php
rename to core/modules/system/tests/https.php
index c342abc..3d07f0c 100644
--- a/core/modules/simpletest/tests/https.php
+++ b/core/modules/system/tests/https.php
@@ -11,7 +11,7 @@ $is_https_mock = empty($_SERVER['HTTPS']);
 // Change to https.
 $_SERVER['HTTPS'] = 'on';
 foreach ($_SERVER as $key => $value) {
-  $_SERVER[$key] = str_replace('core/modules/simpletest/tests/https.php', 'index.php', $value);
+  $_SERVER[$key] = str_replace('core/modules/system/tests/https.php', 'index.php', $value);
   $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]);
 }
 
diff --git a/core/modules/simpletest/tests/image.test b/core/modules/system/tests/image.test
similarity index 100%
rename from core/modules/simpletest/tests/image.test
rename to core/modules/system/tests/image.test
diff --git a/core/modules/simpletest/tests/installer.test b/core/modules/system/tests/installer.test
similarity index 100%
rename from core/modules/simpletest/tests/installer.test
rename to core/modules/system/tests/installer.test
diff --git a/core/modules/simpletest/tests/lock.test b/core/modules/system/tests/lock.test
similarity index 100%
rename from core/modules/simpletest/tests/lock.test
rename to core/modules/system/tests/lock.test
diff --git a/core/modules/simpletest/tests/mail.test b/core/modules/system/tests/mail.test
similarity index 100%
rename from core/modules/simpletest/tests/mail.test
rename to core/modules/system/tests/mail.test
diff --git a/core/modules/simpletest/tests/menu.test b/core/modules/system/tests/menu.test
similarity index 100%
rename from core/modules/simpletest/tests/menu.test
rename to core/modules/system/tests/menu.test
diff --git a/core/modules/simpletest/tests/module.test b/core/modules/system/tests/module.test
similarity index 100%
rename from core/modules/simpletest/tests/module.test
rename to core/modules/system/tests/module.test
diff --git a/core/modules/simpletest/tests/actions_loop_test.info b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.info
similarity index 100%
rename from core/modules/simpletest/tests/actions_loop_test.info
rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.info
diff --git a/core/modules/simpletest/tests/actions_loop_test.install b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.install
similarity index 100%
rename from core/modules/simpletest/tests/actions_loop_test.install
rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.install
diff --git a/core/modules/simpletest/tests/actions_loop_test.module b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.module
similarity index 100%
rename from core/modules/simpletest/tests/actions_loop_test.module
rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.module
diff --git a/core/modules/simpletest/tests/ajax_forms_test.info b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.info
similarity index 100%
rename from core/modules/simpletest/tests/ajax_forms_test.info
rename to core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.info
diff --git a/core/modules/simpletest/tests/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
similarity index 100%
rename from core/modules/simpletest/tests/ajax_forms_test.module
rename to core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
diff --git a/core/modules/simpletest/tests/ajax_test.info b/core/modules/system/tests/modules/ajax_test/ajax_test.info
similarity index 100%
rename from core/modules/simpletest/tests/ajax_test.info
rename to core/modules/system/tests/modules/ajax_test/ajax_test.info
diff --git a/core/modules/simpletest/tests/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module
similarity index 94%
rename from core/modules/simpletest/tests/ajax_test.module
rename to core/modules/system/tests/modules/ajax_test/ajax_test.module
index 21be019..27b3161 100644
--- a/core/modules/simpletest/tests/ajax_test.module
+++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module
@@ -35,7 +35,7 @@ function ajax_test_menu() {
  * Implements hook_system_theme_info().
  */
 function ajax_test_system_theme_info() {
-  $themes['test_theme'] = drupal_get_path('module', 'ajax_test') . '/themes/test_theme/test_theme.info';
+  $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info';
   return $themes;
 }
 
diff --git a/core/modules/simpletest/tests/batch_test.callbacks.inc b/core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc
similarity index 100%
rename from core/modules/simpletest/tests/batch_test.callbacks.inc
rename to core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc
diff --git a/core/modules/simpletest/tests/batch_test.info b/core/modules/system/tests/modules/batch_test/batch_test.info
similarity index 100%
rename from core/modules/simpletest/tests/batch_test.info
rename to core/modules/system/tests/modules/batch_test/batch_test.info
diff --git a/core/modules/simpletest/tests/batch_test.module b/core/modules/system/tests/modules/batch_test/batch_test.module
similarity index 100%
rename from core/modules/simpletest/tests/batch_test.module
rename to core/modules/system/tests/modules/batch_test/batch_test.module
diff --git a/core/modules/simpletest/tests/common_test.css b/core/modules/system/tests/modules/common_test/common_test.css
similarity index 100%
rename from core/modules/simpletest/tests/common_test.css
rename to core/modules/system/tests/modules/common_test/common_test.css
diff --git a/core/modules/simpletest/tests/common_test.info b/core/modules/system/tests/modules/common_test/common_test.info
similarity index 100%
rename from core/modules/simpletest/tests/common_test.info
rename to core/modules/system/tests/modules/common_test/common_test.info
diff --git a/core/modules/simpletest/tests/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module
similarity index 100%
rename from core/modules/simpletest/tests/common_test.module
rename to core/modules/system/tests/modules/common_test/common_test.module
diff --git a/core/modules/simpletest/tests/common_test.print.css b/core/modules/system/tests/modules/common_test/common_test.print.css
similarity index 100%
rename from core/modules/simpletest/tests/common_test.print.css
rename to core/modules/system/tests/modules/common_test/common_test.print.css
diff --git a/core/modules/simpletest/tests/common_test_cron_helper.info b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.info
similarity index 100%
rename from core/modules/simpletest/tests/common_test_cron_helper.info
rename to core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.info
diff --git a/core/modules/simpletest/tests/common_test_cron_helper.module b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module
similarity index 100%
rename from core/modules/simpletest/tests/common_test_cron_helper.module
rename to core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module
diff --git a/core/modules/simpletest/tests/database_test.info b/core/modules/system/tests/modules/database_test/database_test.info
similarity index 100%
rename from core/modules/simpletest/tests/database_test.info
rename to core/modules/system/tests/modules/database_test/database_test.info
diff --git a/core/modules/simpletest/tests/database_test.install b/core/modules/system/tests/modules/database_test/database_test.install
similarity index 100%
rename from core/modules/simpletest/tests/database_test.install
rename to core/modules/system/tests/modules/database_test/database_test.install
diff --git a/core/modules/simpletest/tests/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module
similarity index 100%
rename from core/modules/simpletest/tests/database_test.module
rename to core/modules/system/tests/modules/database_test/database_test.module
diff --git a/core/modules/simpletest/tests/database_test.test b/core/modules/system/tests/modules/database_test/database_test.test
similarity index 100%
rename from core/modules/simpletest/tests/database_test.test
rename to core/modules/system/tests/modules/database_test/database_test.test
diff --git a/core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
similarity index 100%
rename from core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
rename to core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
diff --git a/core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module b/core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module
similarity index 100%
rename from core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module
rename to core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module
diff --git a/core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
similarity index 100%
rename from core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
rename to core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
diff --git a/core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module b/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module
similarity index 100%
rename from core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module
rename to core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module
diff --git a/core/modules/simpletest/tests/error_test.info b/core/modules/system/tests/modules/error_test/error_test.info
similarity index 100%
rename from core/modules/simpletest/tests/error_test.info
rename to core/modules/system/tests/modules/error_test/error_test.info
diff --git a/core/modules/simpletest/tests/error_test.module b/core/modules/system/tests/modules/error_test/error_test.module
similarity index 100%
rename from core/modules/simpletest/tests/error_test.module
rename to core/modules/system/tests/modules/error_test/error_test.module
diff --git a/core/modules/simpletest/tests/file_test.info b/core/modules/system/tests/modules/file_test/file_test.info
similarity index 100%
rename from core/modules/simpletest/tests/file_test.info
rename to core/modules/system/tests/modules/file_test/file_test.info
diff --git a/core/modules/simpletest/tests/file_test.module b/core/modules/system/tests/modules/file_test/file_test.module
similarity index 100%
rename from core/modules/simpletest/tests/file_test.module
rename to core/modules/system/tests/modules/file_test/file_test.module
diff --git a/core/modules/simpletest/tests/filter_test.info b/core/modules/system/tests/modules/filter_test/filter_test.info
similarity index 100%
rename from core/modules/simpletest/tests/filter_test.info
rename to core/modules/system/tests/modules/filter_test/filter_test.info
diff --git a/core/modules/simpletest/tests/filter_test.module b/core/modules/system/tests/modules/filter_test/filter_test.module
similarity index 100%
rename from core/modules/simpletest/tests/filter_test.module
rename to core/modules/system/tests/modules/filter_test/filter_test.module
diff --git a/core/modules/simpletest/tests/form_test.file.inc b/core/modules/system/tests/modules/form_test/form_test.file.inc
similarity index 100%
rename from core/modules/simpletest/tests/form_test.file.inc
rename to core/modules/system/tests/modules/form_test/form_test.file.inc
diff --git a/core/modules/simpletest/tests/form_test.info b/core/modules/system/tests/modules/form_test/form_test.info
similarity index 100%
rename from core/modules/simpletest/tests/form_test.info
rename to core/modules/system/tests/modules/form_test/form_test.info
diff --git a/core/modules/simpletest/tests/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
similarity index 99%
rename from core/modules/simpletest/tests/form_test.module
rename to core/modules/system/tests/modules/form_test/form_test.module
index 4b0f295..92a2b57 100644
--- a/core/modules/simpletest/tests/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -1784,7 +1784,7 @@ function form_test_load_include_custom($form, &$form_state) {
   // Specify the include file and enable form caching. That way the form is
   // cached when it is submitted, but needs to find the specified submit handler
   // in the include.
-  // Filename is a bit weird here: modules/simpletest/tests/form_test.file.inc
+  // Filename is a bit weird here: modules/system/tests/form_test.file.inc
   form_load_include($form_state, 'inc', 'form_test', 'form_test.file');
   $form_state['cache'] = TRUE;
   return $form;
diff --git a/core/modules/simpletest/tests/image_test.info b/core/modules/system/tests/modules/image_test/image_test.info
similarity index 100%
rename from core/modules/simpletest/tests/image_test.info
rename to core/modules/system/tests/modules/image_test/image_test.info
diff --git a/core/modules/simpletest/tests/image_test.module b/core/modules/system/tests/modules/image_test/image_test.module
similarity index 100%
rename from core/modules/simpletest/tests/image_test.module
rename to core/modules/system/tests/modules/image_test/image_test.module
diff --git a/core/modules/simpletest/tests/menu_test.info b/core/modules/system/tests/modules/menu_test/menu_test.info
similarity index 100%
rename from core/modules/simpletest/tests/menu_test.info
rename to core/modules/system/tests/modules/menu_test/menu_test.info
diff --git a/core/modules/simpletest/tests/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
similarity index 100%
rename from core/modules/simpletest/tests/menu_test.module
rename to core/modules/system/tests/modules/menu_test/menu_test.module
diff --git a/core/modules/simpletest/tests/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php b/core/modules/system/tests/modules/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php
similarity index 100%
rename from core/modules/simpletest/tests/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php
rename to core/modules/system/tests/modules/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php
diff --git a/core/modules/simpletest/tests/module_autoload_test/module_autoload_test.info b/core/modules/system/tests/modules/module_autoload_test/module_autoload_test.info
similarity index 100%
rename from core/modules/simpletest/tests/module_autoload_test/module_autoload_test.info
rename to core/modules/system/tests/modules/module_autoload_test/module_autoload_test.info
diff --git a/core/modules/simpletest/tests/module_autoload_test/module_autoload_test.module b/core/modules/system/tests/modules/module_autoload_test/module_autoload_test.module
similarity index 100%
rename from core/modules/simpletest/tests/module_autoload_test/module_autoload_test.module
rename to core/modules/system/tests/modules/module_autoload_test/module_autoload_test.module
diff --git a/core/modules/simpletest/tests/module_test.file.inc b/core/modules/system/tests/modules/module_test/module_test.file.inc
similarity index 100%
rename from core/modules/simpletest/tests/module_test.file.inc
rename to core/modules/system/tests/modules/module_test/module_test.file.inc
diff --git a/core/modules/simpletest/tests/module_test.info b/core/modules/system/tests/modules/module_test/module_test.info
similarity index 100%
rename from core/modules/simpletest/tests/module_test.info
rename to core/modules/system/tests/modules/module_test/module_test.info
diff --git a/core/modules/simpletest/tests/module_test.install b/core/modules/system/tests/modules/module_test/module_test.install
similarity index 100%
rename from core/modules/simpletest/tests/module_test.install
rename to core/modules/system/tests/modules/module_test/module_test.install
diff --git a/core/modules/simpletest/tests/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module
similarity index 100%
rename from core/modules/simpletest/tests/module_test.module
rename to core/modules/system/tests/modules/module_test/module_test.module
diff --git a/core/modules/simpletest/tests/path_test.info b/core/modules/system/tests/modules/path_test/path_test.info
similarity index 100%
rename from core/modules/simpletest/tests/path_test.info
rename to core/modules/system/tests/modules/path_test/path_test.info
diff --git a/core/modules/simpletest/tests/path_test.module b/core/modules/system/tests/modules/path_test/path_test.module
similarity index 100%
rename from core/modules/simpletest/tests/path_test.module
rename to core/modules/system/tests/modules/path_test/path_test.module
diff --git a/core/modules/simpletest/tests/requirements1_test.info b/core/modules/system/tests/modules/requirements1_test/requirements1_test.info
similarity index 100%
rename from core/modules/simpletest/tests/requirements1_test.info
rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.info
diff --git a/core/modules/simpletest/tests/requirements1_test.install b/core/modules/system/tests/modules/requirements1_test/requirements1_test.install
similarity index 100%
rename from core/modules/simpletest/tests/requirements1_test.install
rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.install
diff --git a/core/modules/simpletest/tests/requirements1_test.module b/core/modules/system/tests/modules/requirements1_test/requirements1_test.module
similarity index 100%
rename from core/modules/simpletest/tests/requirements1_test.module
rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.module
diff --git a/core/modules/simpletest/tests/requirements2_test.info b/core/modules/system/tests/modules/requirements2_test/requirements2_test.info
similarity index 100%
rename from core/modules/simpletest/tests/requirements2_test.info
rename to core/modules/system/tests/modules/requirements2_test/requirements2_test.info
diff --git a/core/modules/simpletest/tests/requirements2_test.module b/core/modules/system/tests/modules/requirements2_test/requirements2_test.module
similarity index 100%
rename from core/modules/simpletest/tests/requirements2_test.module
rename to core/modules/system/tests/modules/requirements2_test/requirements2_test.module
diff --git a/core/modules/simpletest/tests/session_test.info b/core/modules/system/tests/modules/session_test/session_test.info
similarity index 100%
rename from core/modules/simpletest/tests/session_test.info
rename to core/modules/system/tests/modules/session_test/session_test.info
diff --git a/core/modules/simpletest/tests/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module
similarity index 100%
rename from core/modules/simpletest/tests/session_test.module
rename to core/modules/system/tests/modules/session_test/session_test.module
diff --git a/core/modules/simpletest/tests/system_dependencies_test.info b/core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_dependencies_test.info
rename to core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.info
diff --git a/core/modules/simpletest/tests/system_dependencies_test.module b/core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_dependencies_test.module
rename to core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.module
diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info b/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info
rename to core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info
diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module b/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module
rename to core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.module
diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_test.info b/core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_core_version_test.info
rename to core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.info
diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_test.module b/core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_core_version_test.module
rename to core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.module
diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info b/core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info
rename to core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.info
diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module b/core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module
rename to core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.module
diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_test.info b/core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_module_version_test.info
rename to core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.info
diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_test.module b/core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_incompatible_module_version_test.module
rename to core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.module
diff --git a/core/modules/simpletest/tests/system_test.info b/core/modules/system/tests/modules/system_test/system_test.info
similarity index 100%
rename from core/modules/simpletest/tests/system_test.info
rename to core/modules/system/tests/modules/system_test/system_test.info
diff --git a/core/modules/simpletest/tests/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module
similarity index 100%
rename from core/modules/simpletest/tests/system_test.module
rename to core/modules/system/tests/modules/system_test/system_test.module
diff --git a/core/modules/simpletest/tests/taxonomy_test.info b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.info
similarity index 100%
rename from core/modules/simpletest/tests/taxonomy_test.info
rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.info
diff --git a/core/modules/simpletest/tests/taxonomy_test.install b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.install
similarity index 100%
rename from core/modules/simpletest/tests/taxonomy_test.install
rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.install
diff --git a/core/modules/simpletest/tests/taxonomy_test.module b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.module
similarity index 100%
rename from core/modules/simpletest/tests/taxonomy_test.module
rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.module
diff --git a/core/modules/simpletest/tests/theme_test.inc b/core/modules/system/tests/modules/theme_test/theme_test.inc
similarity index 100%
rename from core/modules/simpletest/tests/theme_test.inc
rename to core/modules/system/tests/modules/theme_test/theme_test.inc
diff --git a/core/modules/simpletest/tests/theme_test.info b/core/modules/system/tests/modules/theme_test/theme_test.info
similarity index 100%
rename from core/modules/simpletest/tests/theme_test.info
rename to core/modules/system/tests/modules/theme_test/theme_test.info
diff --git a/core/modules/simpletest/tests/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
similarity index 91%
rename from core/modules/simpletest/tests/theme_test.module
rename to core/modules/system/tests/modules/theme_test/theme_test.module
index f6065f2..f2cd4a0 100644
--- a/core/modules/simpletest/tests/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -21,9 +21,9 @@ function theme_test_theme($existing, $type, $theme, $path) {
  * Implements hook_system_theme_info().
  */
 function theme_test_system_theme_info() {
-  $themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info';
-  $themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info';
-  $themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info';
+  $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info';
+  $themes['test_basetheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_basetheme/test_basetheme.info';
+  $themes['test_subtheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_subtheme/test_subtheme.info';
   return $themes;
 }
 
diff --git a/core/modules/simpletest/tests/theme_test.template_test.tpl.php b/core/modules/system/tests/modules/theme_test/theme_test.template_test.tpl.php
similarity index 100%
rename from core/modules/simpletest/tests/theme_test.template_test.tpl.php
rename to core/modules/system/tests/modules/theme_test/theme_test.template_test.tpl.php
diff --git a/core/modules/simpletest/tests/update_script_test.info b/core/modules/system/tests/modules/update_script_test/update_script_test.info
similarity index 100%
rename from core/modules/simpletest/tests/update_script_test.info
rename to core/modules/system/tests/modules/update_script_test/update_script_test.info
diff --git a/core/modules/simpletest/tests/update_script_test.install b/core/modules/system/tests/modules/update_script_test/update_script_test.install
similarity index 100%
rename from core/modules/simpletest/tests/update_script_test.install
rename to core/modules/system/tests/modules/update_script_test/update_script_test.install
diff --git a/core/modules/simpletest/tests/update_script_test.module b/core/modules/system/tests/modules/update_script_test/update_script_test.module
similarity index 100%
rename from core/modules/simpletest/tests/update_script_test.module
rename to core/modules/system/tests/modules/update_script_test/update_script_test.module
diff --git a/core/modules/simpletest/tests/update_test_1.info b/core/modules/system/tests/modules/update_test_1/update_test_1.info
similarity index 100%
rename from core/modules/simpletest/tests/update_test_1.info
rename to core/modules/system/tests/modules/update_test_1/update_test_1.info
diff --git a/core/modules/simpletest/tests/update_test_1.install b/core/modules/system/tests/modules/update_test_1/update_test_1.install
similarity index 100%
rename from core/modules/simpletest/tests/update_test_1.install
rename to core/modules/system/tests/modules/update_test_1/update_test_1.install
diff --git a/core/modules/simpletest/tests/update_test_1.module b/core/modules/system/tests/modules/update_test_1/update_test_1.module
similarity index 100%
rename from core/modules/simpletest/tests/update_test_1.module
rename to core/modules/system/tests/modules/update_test_1/update_test_1.module
diff --git a/core/modules/simpletest/tests/update_test_2.info b/core/modules/system/tests/modules/update_test_2/update_test_2.info
similarity index 100%
rename from core/modules/simpletest/tests/update_test_2.info
rename to core/modules/system/tests/modules/update_test_2/update_test_2.info
diff --git a/core/modules/simpletest/tests/update_test_2.install b/core/modules/system/tests/modules/update_test_2/update_test_2.install
similarity index 100%
rename from core/modules/simpletest/tests/update_test_2.install
rename to core/modules/system/tests/modules/update_test_2/update_test_2.install
diff --git a/core/modules/simpletest/tests/update_test_2.module b/core/modules/system/tests/modules/update_test_2/update_test_2.module
similarity index 100%
rename from core/modules/simpletest/tests/update_test_2.module
rename to core/modules/system/tests/modules/update_test_2/update_test_2.module
diff --git a/core/modules/simpletest/tests/update_test_3.info b/core/modules/system/tests/modules/update_test_3/update_test_3.info
similarity index 100%
rename from core/modules/simpletest/tests/update_test_3.info
rename to core/modules/system/tests/modules/update_test_3/update_test_3.info
diff --git a/core/modules/simpletest/tests/update_test_3.install b/core/modules/system/tests/modules/update_test_3/update_test_3.install
similarity index 100%
rename from core/modules/simpletest/tests/update_test_3.install
rename to core/modules/system/tests/modules/update_test_3/update_test_3.install
diff --git a/core/modules/simpletest/tests/update_test_3.module b/core/modules/system/tests/modules/update_test_3/update_test_3.module
similarity index 100%
rename from core/modules/simpletest/tests/update_test_3.module
rename to core/modules/system/tests/modules/update_test_3/update_test_3.module
diff --git a/core/modules/simpletest/tests/url_alter_test.info b/core/modules/system/tests/modules/url_alter_test/url_alter_test.info
similarity index 100%
rename from core/modules/simpletest/tests/url_alter_test.info
rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.info
diff --git a/core/modules/simpletest/tests/url_alter_test.install b/core/modules/system/tests/modules/url_alter_test/url_alter_test.install
similarity index 100%
rename from core/modules/simpletest/tests/url_alter_test.install
rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.install
diff --git a/core/modules/simpletest/tests/url_alter_test.module b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module
similarity index 100%
rename from core/modules/simpletest/tests/url_alter_test.module
rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.module
diff --git a/core/modules/simpletest/tests/xmlrpc_test.info b/core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.info
similarity index 100%
rename from core/modules/simpletest/tests/xmlrpc_test.info
rename to core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.info
diff --git a/core/modules/simpletest/tests/xmlrpc_test.module b/core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.module
similarity index 100%
rename from core/modules/simpletest/tests/xmlrpc_test.module
rename to core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.module
diff --git a/core/modules/simpletest/tests/password.test b/core/modules/system/tests/password.test
similarity index 100%
rename from core/modules/simpletest/tests/password.test
rename to core/modules/system/tests/password.test
diff --git a/core/modules/simpletest/tests/path.test b/core/modules/system/tests/path.test
similarity index 100%
rename from core/modules/simpletest/tests/path.test
rename to core/modules/system/tests/path.test
diff --git a/core/modules/simpletest/tests/queue.test b/core/modules/system/tests/queue.test
similarity index 100%
rename from core/modules/simpletest/tests/queue.test
rename to core/modules/system/tests/queue.test
diff --git a/core/modules/simpletest/tests/registry.test b/core/modules/system/tests/registry.test
similarity index 100%
rename from core/modules/simpletest/tests/registry.test
rename to core/modules/system/tests/registry.test
diff --git a/core/modules/simpletest/tests/schema.test b/core/modules/system/tests/schema.test
similarity index 100%
rename from core/modules/simpletest/tests/schema.test
rename to core/modules/system/tests/schema.test
diff --git a/core/modules/simpletest/tests/session.test b/core/modules/system/tests/session.test
similarity index 99%
rename from core/modules/simpletest/tests/session.test
rename to core/modules/system/tests/session.test
index 6303ca5..017a8ba 100644
--- a/core/modules/simpletest/tests/session.test
+++ b/core/modules/system/tests/session.test
@@ -513,7 +513,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
    */
   protected function httpsUrl($url) {
     global $base_url;
-    return $base_url . '/core/modules/simpletest/tests/https.php?q=' . $url;
+    return $base_url . '/core/modules/system/tests/https.php?q=' . $url;
   }
 
   /**
@@ -527,7 +527,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
    */
   protected function httpUrl($url) {
     global $base_url;
-    return $base_url . '/core/modules/simpletest/tests/http.php?q=' . $url;
+    return $base_url . '/core/modules/system/tests/http.php?q=' . $url;
   }
 }
 
diff --git a/core/modules/simpletest/tests/symfony.test b/core/modules/system/tests/symfony.test
similarity index 100%
rename from core/modules/simpletest/tests/symfony.test
rename to core/modules/system/tests/symfony.test
diff --git a/core/modules/simpletest/tests/system.base.css b/core/modules/system/tests/system.base.css
similarity index 100%
rename from core/modules/simpletest/tests/system.base.css
rename to core/modules/system/tests/system.base.css
diff --git a/core/modules/simpletest/tests/tablesort.test b/core/modules/system/tests/tablesort.test
similarity index 100%
rename from core/modules/simpletest/tests/tablesort.test
rename to core/modules/system/tests/tablesort.test
diff --git a/core/modules/simpletest/tests/theme.test b/core/modules/system/tests/theme.test
similarity index 100%
rename from core/modules/simpletest/tests/theme.test
rename to core/modules/system/tests/theme.test
diff --git a/core/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info b/core/modules/system/tests/themes/test_basetheme/test_basetheme.info
similarity index 100%
rename from core/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info
rename to core/modules/system/tests/themes/test_basetheme/test_basetheme.info
diff --git a/core/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info b/core/modules/system/tests/themes/test_subtheme/test_subtheme.info
similarity index 100%
rename from core/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info
rename to core/modules/system/tests/themes/test_subtheme/test_subtheme.info
diff --git a/core/modules/simpletest/tests/themes/test_theme/template.php b/core/modules/system/tests/themes/test_theme/template.php
similarity index 100%
rename from core/modules/simpletest/tests/themes/test_theme/template.php
rename to core/modules/system/tests/themes/test_theme/template.php
diff --git a/core/modules/simpletest/tests/themes/test_theme/test_theme.info b/core/modules/system/tests/themes/test_theme/test_theme.info
similarity index 100%
rename from core/modules/simpletest/tests/themes/test_theme/test_theme.info
rename to core/modules/system/tests/themes/test_theme/test_theme.info
diff --git a/core/modules/simpletest/tests/themes/test_theme/theme_test.template_test.tpl.php b/core/modules/system/tests/themes/test_theme/theme_test.template_test.tpl.php
similarity index 100%
rename from core/modules/simpletest/tests/themes/test_theme/theme_test.template_test.tpl.php
rename to core/modules/system/tests/themes/test_theme/theme_test.template_test.tpl.php
diff --git a/core/modules/simpletest/tests/unicode.test b/core/modules/system/tests/unicode.test
similarity index 100%
rename from core/modules/simpletest/tests/unicode.test
rename to core/modules/system/tests/unicode.test
diff --git a/core/modules/simpletest/tests/update.test b/core/modules/system/tests/update.test
similarity index 100%
rename from core/modules/simpletest/tests/update.test
rename to core/modules/system/tests/update.test
diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.bare.database.php.gz b/core/modules/system/tests/upgrade/drupal-7.bare.database.php.gz
similarity index 100%
rename from core/modules/simpletest/tests/upgrade/drupal-7.bare.database.php.gz
rename to core/modules/system/tests/upgrade/drupal-7.bare.database.php.gz
diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.filled.database.php.gz b/core/modules/system/tests/upgrade/drupal-7.filled.database.php.gz
similarity index 100%
rename from core/modules/simpletest/tests/upgrade/drupal-7.filled.database.php.gz
rename to core/modules/system/tests/upgrade/drupal-7.filled.database.php.gz
diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.language.database.php b/core/modules/system/tests/upgrade/drupal-7.language.database.php
similarity index 100%
rename from core/modules/simpletest/tests/upgrade/drupal-7.language.database.php
rename to core/modules/system/tests/upgrade/drupal-7.language.database.php
diff --git a/core/modules/simpletest/tests/upgrade/upgrade.language.test b/core/modules/system/tests/upgrade/upgrade.language.test
similarity index 97%
rename from core/modules/simpletest/tests/upgrade/upgrade.language.test
rename to core/modules/system/tests/upgrade/upgrade.language.test
index 192f00c..3f8483b 100644
--- a/core/modules/simpletest/tests/upgrade/upgrade.language.test
+++ b/core/modules/system/tests/upgrade/upgrade.language.test
@@ -22,8 +22,8 @@ class LanguageUpgradePathTestCase extends UpgradePathTestCase {
   public function setUp() {
     // Path to the database dump files.
     $this->databaseDumpFiles = array(
-      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
-      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php',
+      drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.database.php.gz',
+      drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.language.database.php',
     );
     parent::setUp();
   }
diff --git a/core/modules/simpletest/tests/upgrade/upgrade.test b/core/modules/system/tests/upgrade/upgrade.test
similarity index 100%
rename from core/modules/simpletest/tests/upgrade/upgrade.test
rename to core/modules/system/tests/upgrade/upgrade.test
diff --git a/core/modules/simpletest/tests/upgrade/upgrade_bare.test b/core/modules/system/tests/upgrade/upgrade_bare.test
similarity index 89%
rename from core/modules/simpletest/tests/upgrade/upgrade_bare.test
rename to core/modules/system/tests/upgrade/upgrade_bare.test
index f507aea..71553d3 100644
--- a/core/modules/simpletest/tests/upgrade/upgrade_bare.test
+++ b/core/modules/system/tests/upgrade/upgrade_bare.test
@@ -17,7 +17,7 @@ class BareUpgradePathTestCase extends UpgradePathTestCase {
   public function setUp() {
     // Path to the database dump.
     $this->databaseDumpFiles = array(
-      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.bare.database.php.gz',
+      drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.database.php.gz',
     );
     parent::setUp();
   }
diff --git a/core/modules/simpletest/tests/upgrade/upgrade_filled.test b/core/modules/system/tests/upgrade/upgrade_filled.test
similarity index 87%
rename from core/modules/simpletest/tests/upgrade/upgrade_filled.test
rename to core/modules/system/tests/upgrade/upgrade_filled.test
index 9b17bda..947d830 100644
--- a/core/modules/simpletest/tests/upgrade/upgrade_filled.test
+++ b/core/modules/system/tests/upgrade/upgrade_filled.test
@@ -17,7 +17,7 @@ class FilledUpgradePathTestCase extends UpgradePathTestCase {
   public function setUp() {
     // Path to the database dump.
     $this->databaseDumpFiles = array(
-      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
+      drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.database.php.gz',
     );
     parent::setUp();
   }
diff --git a/core/modules/simpletest/tests/uuid.test b/core/modules/system/tests/uuid.test
similarity index 100%
rename from core/modules/simpletest/tests/uuid.test
rename to core/modules/system/tests/uuid.test
diff --git a/core/modules/simpletest/tests/xmlrpc.test b/core/modules/system/tests/xmlrpc.test
similarity index 100%
rename from core/modules/simpletest/tests/xmlrpc.test
rename to core/modules/system/tests/xmlrpc.test
diff --git a/core/modules/update/tests/aaa_update_test.info b/core/modules/update/tests/modules/aaa_update_test/aaa_update_test.info
similarity index 100%
rename from core/modules/update/tests/aaa_update_test.info
rename to core/modules/update/tests/modules/aaa_update_test/aaa_update_test.info
diff --git a/core/modules/update/tests/aaa_update_test.module b/core/modules/update/tests/modules/aaa_update_test/aaa_update_test.module
similarity index 100%
rename from core/modules/update/tests/aaa_update_test.module
rename to core/modules/update/tests/modules/aaa_update_test/aaa_update_test.module
diff --git a/core/modules/update/tests/bbb_update_test.info b/core/modules/update/tests/modules/bbb_update_test/bbb_update_test.info
similarity index 100%
rename from core/modules/update/tests/bbb_update_test.info
rename to core/modules/update/tests/modules/bbb_update_test/bbb_update_test.info
diff --git a/core/modules/update/tests/bbb_update_test.module b/core/modules/update/tests/modules/bbb_update_test/bbb_update_test.module
similarity index 100%
rename from core/modules/update/tests/bbb_update_test.module
rename to core/modules/update/tests/modules/bbb_update_test/bbb_update_test.module
diff --git a/core/modules/update/tests/ccc_update_test.info b/core/modules/update/tests/modules/ccc_update_test/ccc_update_test.info
similarity index 100%
rename from core/modules/update/tests/ccc_update_test.info
rename to core/modules/update/tests/modules/ccc_update_test/ccc_update_test.info
diff --git a/core/modules/update/tests/ccc_update_test.module b/core/modules/update/tests/modules/ccc_update_test/ccc_update_test.module
similarity index 100%
rename from core/modules/update/tests/ccc_update_test.module
rename to core/modules/update/tests/modules/ccc_update_test/ccc_update_test.module
diff --git a/core/modules/update/tests/aaa_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0.xml
similarity index 100%
rename from core/modules/update/tests/aaa_update_test.1_0.xml
rename to core/modules/update/tests/modules/update_test/aaa_update_test.1_0.xml
diff --git a/core/modules/update/tests/aaa_update_test.no-releases.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.no-releases.xml
similarity index 100%
rename from core/modules/update/tests/aaa_update_test.no-releases.xml
rename to core/modules/update/tests/modules/update_test/aaa_update_test.no-releases.xml
diff --git a/core/modules/update/tests/bbb_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml
similarity index 100%
rename from core/modules/update/tests/bbb_update_test.1_0.xml
rename to core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml
diff --git a/core/modules/update/tests/ccc_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/ccc_update_test.1_0.xml
similarity index 100%
rename from core/modules/update/tests/ccc_update_test.1_0.xml
rename to core/modules/update/tests/modules/update_test/ccc_update_test.1_0.xml
diff --git a/core/modules/update/tests/drupal.0.xml b/core/modules/update/tests/modules/update_test/drupal.0.xml
similarity index 100%
rename from core/modules/update/tests/drupal.0.xml
rename to core/modules/update/tests/modules/update_test/drupal.0.xml
diff --git a/core/modules/update/tests/drupal.1.xml b/core/modules/update/tests/modules/update_test/drupal.1.xml
similarity index 100%
rename from core/modules/update/tests/drupal.1.xml
rename to core/modules/update/tests/modules/update_test/drupal.1.xml
diff --git a/core/modules/update/tests/drupal.2-sec.xml b/core/modules/update/tests/modules/update_test/drupal.2-sec.xml
similarity index 100%
rename from core/modules/update/tests/drupal.2-sec.xml
rename to core/modules/update/tests/modules/update_test/drupal.2-sec.xml
diff --git a/core/modules/update/tests/drupal.dev.xml b/core/modules/update/tests/modules/update_test/drupal.dev.xml
similarity index 100%
rename from core/modules/update/tests/drupal.dev.xml
rename to core/modules/update/tests/modules/update_test/drupal.dev.xml
diff --git a/core/modules/update/tests/update_test.info b/core/modules/update/tests/modules/update_test/update_test.info
similarity index 100%
rename from core/modules/update/tests/update_test.info
rename to core/modules/update/tests/modules/update_test/update_test.info
diff --git a/core/modules/update/tests/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module
similarity index 97%
rename from core/modules/update/tests/update_test.module
rename to core/modules/update/tests/modules/update_test/update_test.module
index 312a6dd..ff5aad5 100644
--- a/core/modules/update/tests/update_test.module
+++ b/core/modules/update/tests/modules/update_test/update_test.module
@@ -4,8 +4,8 @@
  * Implements hook_system_theme_info().
  */
 function update_test_system_theme_info() {
-  $themes['update_test_basetheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_basetheme/update_test_basetheme.info';
-  $themes['update_test_subtheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_subtheme/update_test_subtheme.info';
+  $themes['update_test_basetheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_basetheme/update_test_basetheme.info';
+  $themes['update_test_subtheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_subtheme/update_test_subtheme.info';
   return $themes;
 }
 
diff --git a/core/modules/update/tests/update_test_basetheme.1_1-sec.xml b/core/modules/update/tests/modules/update_test/update_test_basetheme.1_1-sec.xml
similarity index 100%
rename from core/modules/update/tests/update_test_basetheme.1_1-sec.xml
rename to core/modules/update/tests/modules/update_test/update_test_basetheme.1_1-sec.xml
diff --git a/core/modules/update/tests/update_test_subtheme.1_0.xml b/core/modules/update/tests/modules/update_test/update_test_subtheme.1_0.xml
similarity index 100%
rename from core/modules/update/tests/update_test_subtheme.1_0.xml
rename to core/modules/update/tests/modules/update_test/update_test_subtheme.1_0.xml
diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc
index 2ccd97c..c68104d 100644
--- a/core/modules/update/update.compare.inc
+++ b/core/modules/update/update.compare.inc
@@ -129,7 +129,7 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
     // which is left alone by tar and correctly set to the time the .info file
     // was unpacked.
     if (!isset($file->info['_info_file_ctime'])) {
-      $info_filename = dirname($file->uri) . '/' . $file->name . '.info';
+      $info_filename = $file->uri . '/' . $file->name . '.info';
       $file->info['_info_file_ctime'] = filectime($info_filename);
     }
 
diff --git a/core/themes/engines/phptemplate/phptemplate.engine b/core/themes/engines/phptemplate/phptemplate.engine
index d293b85..8467db3 100644
--- a/core/themes/engines/phptemplate/phptemplate.engine
+++ b/core/themes/engines/phptemplate/phptemplate.engine
@@ -9,7 +9,7 @@
  * Implements hook_init().
  */
 function phptemplate_init($template) {
-  $file = dirname($template->filename) . '/template.php';
+  $file = $template->uri . '/template.php';
   if (file_exists($file)) {
     include_once DRUPAL_ROOT . '/' . $file;
   }
diff --git a/core/update.php b/core/update.php
index 3d858a2..1d32aa9 100644
--- a/core/update.php
+++ b/core/update.php
@@ -394,7 +394,7 @@ if (empty($op) && update_access_allowed()) {
 
   // Load module basics.
   include_once DRUPAL_ROOT . '/core/includes/module.inc';
-  $module_list['system']['filename'] = 'core/modules/system/system.module';
+  $module_list['system']['uri'] = 'core/modules/system';
   module_list(TRUE, FALSE, FALSE, $module_list);
   drupal_load('module', 'system');
 
