@@ -71,35 +71,92 @@ jobs:
7171 cd build
7272 ctest --output-on-failure
7373
74- - name : Test CLI
74+ - name : Test CLI functionality
7575 run : |
7676 # Create test data
7777 mkdir -p test_data
78- echo "Release test" > test_data/test.txt
79- echo "Sensitive data for encryption test" > test_data/secret.txt
78+ echo "Hello World" > test_data/hello.txt
79+ echo "Goodbye" > test_data/bye.txt
80+ mkdir -p test_data/subdir
81+ echo "Nested file" > test_data/subdir/nested.txt
8082
81- # Test basic functionality
83+ # Test CLI workflow
8284 ./build/bin/bfc create test.bfc test_data/
8385 ./build/bin/bfc list test.bfc
86+ ./build/bin/bfc info test.bfc
8487 ./build/bin/bfc verify test.bfc
85-
86- # Test encryption functionality (password-based)
87- ./build/bin/bfc create -e testpass encrypted.bfc test_data/
88- ./build/bin/bfc list encrypted.bfc
89- ./build/bin/bfc verify encrypted.bfc
90-
91- # Test extraction with password
92- mkdir -p extracted
93- ./build/bin/bfc extract -p testpass -C extracted encrypted.bfc
94- diff test_data/test.txt extracted/test.txt
95- diff test_data/secret.txt extracted/secret.txt
88+ ./build/bin/bfc verify --deep test.bfc
89+
90+ # Test compression functionality
91+ ./build/bin/bfc create -c zstd test_compressed.bfc test_data/
92+ ./build/bin/bfc info test_compressed.bfc test_data/hello.txt
93+ ./build/bin/bfc verify test_compressed.bfc
94+
95+ # Test different compression levels
96+ ./build/bin/bfc create -c zstd -l 1 test_fast.bfc test_data/
97+ ./build/bin/bfc create -c zstd -l 6 test_balanced.bfc test_data/
98+ ./build/bin/bfc info test_balanced.bfc test_data/hello.txt
99+
100+ # Test extraction
101+ mkdir -p extract_test
102+ cd extract_test
103+ ../build/bin/bfc extract ../test.bfc
104+
105+ # Verify extracted files
106+ [ -f hello.txt ] && echo "hello.txt extracted"
107+ [ -f bye.txt ] && echo "bye.txt extracted"
108+ [ -f subdir/nested.txt ] && echo "nested.txt extracted"
109+
110+ cd ..
111+ rm -rf extract_test
112+
113+ # Test encryption functionality
114+ echo "Testing encryption features..."
115+ ./build/bin/bfc create -e testpassword123 test_encrypted.bfc test_data/
116+ ./build/bin/bfc info test_encrypted.bfc
117+ ./build/bin/bfc info test_encrypted.bfc test_data/hello.txt | grep -i encrypt
118+
119+ # Test encrypted extraction
120+ mkdir -p extract_encrypted
121+ cd extract_encrypted
122+ ../build/bin/bfc extract -p testpassword123 ../test_encrypted.bfc
123+
124+ # Verify extracted files from encrypted container
125+ [ -f hello.txt ] && echo "hello.txt extracted from encrypted container"
126+ [ -f bye.txt ] && echo "bye.txt extracted from encrypted container"
127+ [ -f subdir/nested.txt ] && echo "nested.txt extracted from encrypted container"
128+
129+ cd ..
130+ rm -rf extract_encrypted
131+
132+ # Test wrong password failure
133+ mkdir -p extract_fail_test
134+ cd extract_fail_test
135+ ! ../build/bin/bfc extract -p wrongpassword ../test_encrypted.bfc && echo "Correctly failed with wrong password"
136+ cd ..
137+ rm -rf extract_fail_test
138+
139+ # Test key file encryption
140+ echo -n "0123456789abcdef0123456789abcdef" > test.key
141+ ./build/bin/bfc create -k test.key test_keyfile.bfc test_data/
142+ ./build/bin/bfc info test_keyfile.bfc | grep -i encrypt
143+
144+ mkdir -p extract_keyfile
145+ cd extract_keyfile
146+ ../build/bin/bfc extract -K ../test.key ../test_keyfile.bfc
147+ [ -f hello.txt ] && echo "hello.txt extracted with key file"
148+ cd ..
149+ rm -rf extract_keyfile
96150
97151 # Test encryption with compression
98- ./build/bin/bfc create -e testpass -c zstd compressed_encrypted.bfc test_data/
99- ./build/bin/bfc verify compressed_encrypted.bfc
152+ echo "This is a larger test file with enough content to be compressed by zstd compression algorithm." > test_data/large.txt
153+ ./build/bin/bfc create -e testpass -c zstd test_enc_comp.bfc test_data/
154+ ./build/bin/bfc info test_enc_comp.bfc test_data/large.txt | grep -i encrypt
155+ ./build/bin/bfc info test_enc_comp.bfc test_data/large.txt | grep -i zstd
100156
101157 # Clean up
102- rm -rf test_data test.bfc encrypted.bfc compressed_encrypted.bfc extracted
158+ rm -rf test.bfc test_data test_compressed.bfc test_fast.bfc test_balanced.bfc
159+ rm -rf test_encrypted.bfc test_keyfile.bfc test_enc_comp.bfc test.key
103160
104161 - name : Get version
105162 id : get_version
0 commit comments