# -*- encoding: UTF8 -*-
# Test harness for depot_verify_chunks.py
from __future__ import print_function
import sys
import unittest
import os
import re
import P4
curr_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(curr_dir, "..", "..", "bin", "triggers", "tests"))
from p4testutils import TestCase, P4Server, localDirectory, create_file, append_to_file
from depot_verify_chunks import depot_verify_chunks, parse_human_fmt
os.environ["LOGS"] = "."
LOGGER_NAME = "Testdepot_verify_chunks"
LOG_FILE = "log-Testdepot_verify_chunks.log"
class Testdepot_verify_chunks(TestCase):
def __init__(self, methodName='runTest'):
super(Testdepot_verify_chunks, self).__init__(LOGGER_NAME, LOG_FILE, methodName=methodName)
def setUp(self):
self.server = P4Server()
p4 = self.server.p4
self.p4 = p4
p4.logger = self.logger
def tearDown(self):
pass
def testParse(self):
"""Check parsing of args"""
valid_args = {'1': 1, '1.9': 1, '1k': 1024, '1.1m': int(1024 * 1024 * 1.1),
'2k': 2 * 1024, '.5k': 512, '.5K': 512,
'1G': 1024 * 1024 * 1024}
for k in valid_args.keys():
exp = valid_args[k]
act = parse_human_fmt(k)
self.assertEqual(exp, act, "Expected %s got %d" % (exp, act))
invalid_args = ['a', ' 1.', '1.9c', '1.2.3']
for k in invalid_args:
try:
act = parse_human_fmt(k)
self.assertFalse(True, "Expected assertion error for %s" % (k))
except TypeError:
pass
def testdepot_verify_chunks(self):
"""check that fixes are appropriate controlled"""
p4 = self.p4
files = localDirectory(self.server.client_root, "files")
d1 = localDirectory(files, "d1")
d2 = localDirectory(files, "d2")
for i in range(10):
f = os.path.join(d1, "file_%d" % i)
create_file(f, "0123456789\n" * 10)
f = os.path.join(d2, "file_%d" % i)
create_file(f, "0123456789\n" * 10)
p4.run_add("%s/..." % files)
p4.run_submit("-d", "Initial change")
dvc = depot_verify_chunks("-p", p4.port, "-u", p4.user, "-m", "1000000", "//depot/...")
results = dvc.run()
self.assertEqual(['//depot/...'], results)
dvc = depot_verify_chunks("-p", p4.port, "-u", p4.user, "-m", "1000", "//depot/...")
results = dvc.run()
self.assertEqual(['//depot/files/d1/*', '//depot/files/*', '//depot/files/d2/*', '//depot/*'], results)
dvc = depot_verify_chunks("-p", p4.port, "-u", p4.user, "-m", "1500", "//depot/...")
results = dvc.run()
self.assertEqual(['//depot/files/d1/...', '//depot/files/*', '//depot/files/d2/...', '//depot/*'], results)
p4.run_populate("//depot/files/...", "//depot/dev/...")
dvc = depot_verify_chunks("-p", p4.port, "-u", p4.user, "-m", "1500", "//depot/...")
results = dvc.run()
self.assertEqual(['//depot/dev/...', '//depot/*', '//depot/files/d1/...',
'//depot/files/*', '//depot/files/d2/...'], results)
if __name__ == '__main__':
unittest.main()
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 33444 | Claude (AI Agent by Anthropic) | Initial population of r26.1.0.BETA from main. | ||
| //p4-sdp/main/Server/Unix/p4/common/bin/test/test_depot_verify_chunks.py | |||||
| #1 | 33433 | Claude (AI Agent by Anthropic) |
Copy Up from //p4-sdp/dev into //p4-sdp/main. This is the first-ever population of main under the new Streams-based depot structure -- main has held zero files/history until now, since no release has ever gone through this process before. 463 files, covering the entire 2026.1 cycle: rebranding (SDP-1379), Secure By Default (SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version identification (SDP-1161/SDP-799), the Streams-native release process redesign itself (Task 5), the opt_perforce_sdp_backup.sh false-error fix, the P4D 2026.1 test-suite targeting, refreshed P4*.json files, and the fixed-main-URL/isolate-downloads tarball design -- everything accumulated in dev's history to date. Isolated paths (ai_dev_support/, Version, doc/*.html, doc/*.pdf, doc/gen/*.man.txt, doc/gen/sdp_install.cfg, Unsupported/doc/*.html, Unsupported/doc/*.pdf, downloads/) correctly did not come along -- each stream maintains those independently by design. Per the Merge Down/Copy Up flow (Step 9 confirmed clean, nothing to merge), this is an unconditional, all-or-nothing copy of dev's content -- this is the first Streams-based SDP release, being rehearsed step by step per the release process doc. Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic. |
||
| //p4-sdp/dev/Server/Unix/p4/common/bin/test/test_depot_verify_chunks.py | |||||
| #1 | 31397 | C. Thomas Tyler | Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368. | ||
| //guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/test/test_depot_verify_chunks.py | |||||
| #1 | 26932 | C. Thomas Tyler |
Repurposed the /p4/common/site directory. This directory will exist on a a fresh SDP install, but will be empty save for a ReadMe.txt file explaining that it is to be used to make local extensions to the SDP, and that anything in here is not supported. The coming automated SDP upgrade procedure will know to ignore /p4/common/site directory tree. The p4_vars ensures that /p4/common/site/bin is in the PATH. |
||
| //guest/perforce_software/sdp/dev/Server/Unix/p4/common/site/bin/test_depot_verify_chunks.py | |||||
| #1 | 25067 | Robert Cowham | Utility to analyse a depot in chunks | ||